hi
i am using C#.net to code. I am using windows desktop application. I have a main form with a menu stript. and in that i have add details update details and some other menus too.
i want to know how can i design a interface for each menu stript. is it in the same form or what?
because the main form as it is being displayed there is nothing
how can i do this

thanks

Could you post your code? I'm having trouble understanding what your question is.

there is no code
i am still in the design phase

what i want to do is for each menu in the menu strip without using a windows form for each one how can design all the menus with a minimun munber of form,

say for eg if i am going to use one form how can i design all the menu desihn inthat form

So do you want to use a tool strip (which has a number of menus which contain a number of menu items like file and help in Windows) on a form to minimise the number of forms you will need to implement all the required functions ?

I think they're asking how to design a separate interface for each option in the menu strip.

Which is in essence, just making another form, designing the interface and loading it when you click the option.

Could get more advanced by using a base window and overlaying UserControls.

I think they're asking how to design a separate interface for each option in the menu strip.

Which is in essence, just making another form, designing the interface and loading it when you click the option.

Could get more advanced by using a base window and overlaying UserControls.

yes this is what i needed for the solution,
so what yo are saying is for each menu in the menu stript create a different form and then design without designing all of the menu stript in the same form

i just wnat to make clear

You can put a form on a form as a user control and you just change which user control you want to show. It's a pretty neat way of doing things.

Look up WinForms UserControls on Google.

You can put a form on a form as a user control and you just change which user control you want to show. It's a pretty neat way of doing things.

Look up WinForms UserControls on Google.

how can i do this,

how can i do this,

how to i can i call a user control in C#.net

Edited 5 Years Ago by judithSampathwa: edit

The following quick example should help.

public Form1()
{
	InitializeComponent();

	// create embedded form
	var form = new Form();
	form.SetBounds(100, 100, 200, 300);
	form.BackColor = Color.PaleTurquoise; // set to highlight this form position
	form.TopLevel = false; // important otherwise cannot add to Control collection
	form.Visible = true; // important otherwise form does not show
	form.FormBorderStyle = FormBorderStyle.None; // comment out to enable user to move form about

	// add a button to the embedded form
	var b1 = new Button();
	b1.Location = new Point(20, 20);
	b1.Text = @"Test button";
	b1.Click += b1_Click;
	form.Controls.Add(b1);

	this.Controls.Add(form);
}

void b1_Click(object sender, EventArgs e) { MessageBox.Show(@"Test button pressed!"); }

The following quick example should help.

public Form1()
{
	InitializeComponent();

	// create embedded form
	var form = new Form();
	form.SetBounds(100, 100, 200, 300);
	form.BackColor = Color.PaleTurquoise; // set to highlight this form position
	form.TopLevel = false; // important otherwise cannot add to Control collection
	form.Visible = true; // important otherwise form does not show
	form.FormBorderStyle = FormBorderStyle.None; // comment out to enable user to move form about

	// add a button to the embedded form
	var b1 = new Button();
	b1.Location = new Point(20, 20);
	b1.Text = @"Test button";
	b1.Click += b1_Click;
	form.Controls.Add(b1);

	this.Controls.Add(form);
}

void b1_Click(object sender, EventArgs e) { MessageBox.Show(@"Test button pressed!"); }

hi
wasn't clear
what is Form1 and form

Form1() is the constructor for my "MainForm" in my test program.
form is a newly created Form that I use as if it is a normal control.
The code is an example on how to use a form as a control on another form.

Edited 5 Years Ago by nick.crane: n/a

This article has been dead for over six months. Start a new discussion instead.