954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

menu strip problem

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

judithSampathwa
Posting Pro in Training
453 posts since May 2010
Reputation Points: 8
Solved Threads: 0
 

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

nmaillet
Posting Whiz in Training
236 posts since Aug 2008
Reputation Points: 69
Solved Threads: 53
 
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

judithSampathwa
Posting Pro in Training
453 posts since May 2010
Reputation Points: 8
Solved Threads: 0
 

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 ?

ChrisHunter
Posting Whiz in Training
276 posts since Feb 2011
Reputation Points: 36
Solved Threads: 28
 

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.

Ketsuekiame
Master Poster
752 posts since May 2010
Reputation Points: 349
Solved Threads: 107
 

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

judithSampathwa
Posting Pro in Training
453 posts since May 2010
Reputation Points: 8
Solved Threads: 0
 

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.

Ketsuekiame
Master Poster
752 posts since May 2010
Reputation Points: 349
Solved Threads: 107
 

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,

judithSampathwa
Posting Pro in Training
453 posts since May 2010
Reputation Points: 8
Solved Threads: 0
 
how can i do this,


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

judithSampathwa
Posting Pro in Training
453 posts since May 2010
Reputation Points: 8
Solved Threads: 0
 

does someone have a tutorial on calling user control in a form???

judithSampathwa
Posting Pro in Training
453 posts since May 2010
Reputation Points: 8
Solved Threads: 0
 

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!"); }
nick.crane
Nearly a Posting Virtuoso
1,230 posts since Feb 2010
Reputation Points: 375
Solved Threads: 187
 

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

judithSampathwa
Posting Pro in Training
453 posts since May 2010
Reputation Points: 8
Solved Threads: 0
 

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.

nick.crane
Nearly a Posting Virtuoso
1,230 posts since Feb 2010
Reputation Points: 375
Solved Threads: 187
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: