Hi there

Iam new to C# and I need help with creating a dynamic web form using C#.

It should have labels, buttons, one combobox, picture boxes and textboxes.

The user should be able to select a member from the combobox or the user can add a member to the combobox...when the user clicks on the add button it should then add the member to the combobox

Here is my code so far:

using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Smart_Village_Form
{
    public partial class frmSmartVillage : Form
    {
        public frmSmartVillage()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            TextBox txtText = new TextBox();
        }

        public class MenuDialog : Form
        {
            TextBox text = new TextBox();

            public MenuDialog()
            {
                Size = new Size(500, 200);

                text.Size = new Size(490, 190);
                text.Multiline = true;
                text.ScrollBars = ScrollBars.Both;
                text.WordWrap = false;
                text.Location = new Point(5, 5);

                MenuItem fileMenu = new MenuItem("File");
                MenuItem open = new MenuItem("Open");
                open.Shortcut = Shortcut.CtrlO;
                MenuItem save = new MenuItem("Save");
                save.Shortcut = Shortcut.CtrlS;
                fileMenu.MenuItems.Add(open);
                fileMenu.MenuItems.Add(save);

                MenuItem formatMenu = new MenuItem("Format");
                MenuItem font = new MenuItem("Font");
                font.Shortcut = Shortcut.CtrlF;
                formatMenu.MenuItems.Add(font);

                MainMenu bar = new MainMenu();
                Menu = bar;
                bar.MenuItems.Add(fileMenu);
                bar.MenuItems.Add(formatMenu);

                Controls.Add(text);

                open.Click += new EventHandler(Open_Click);
                save.Click += new EventHandler(Save_Click);
                font.Click += new EventHandler(Font_Click);
            }

            protected void Open_Click(object sender, EventArgs e)
            {
                OpenFileDialog o = new OpenFileDialog();
                if (o.ShowDialog() == DialogResult.OK)
                {
                    Stream file = o.OpenFile();
                    StreamReader reader = new StreamReader(file);
                    char[] data = new char[file.Length];
                    reader.ReadBlock(data, 0, (int)file.Length);
                    text.Text = new String(data);
                    reader.Close();
                }
            }

            protected void Save_Click(object sender, EventArgs e)
            {
                SaveFileDialog s = new SaveFileDialog();
                if (s.ShowDialog() == DialogResult.OK)
                {
                    StreamWriter writer = new StreamWriter(s.OpenFile());
                    writer.Write(text.Text);
                    writer.Close();
                }
            }

            private void close_Click(object sender, EventArgs e)
            {
                Close();
            }

            protected void Font_Click(object sender, EventArgs e)
            {
                FontDialog fd = new FontDialog();
                if (fd.ShowDialog() == DialogResult.OK)
                {
                    text.Font = fd.Font;
                }
            }

            public static void main()
            {
                Application.Run(new MenuDialog());
            }
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            txtMembers = new TextBox();
            cboMembers.Items.Add(txtMembers.Text);
        }
    }
}

I would appreciate any help
Thanx
Camzie

so what are the errors you getting?

>>Iam new to C# and I need help with creating a dynamic web form using C#.

Your post was for a windows form, not a web form. And as avirag asked -- what problems are you having?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.