VB.NET - how to set the start position of the form

Asked By abinav shankar on 07-Nov-11 12:47 AM

hi

i have designed a form whose start position is centerscreen and in that form i have a button when the button is clicked i instantiate another form whose start  position is  center parent but what happens is this form gets hidden inside the previous form created  but i need it in front of it how to set the position correctly

thanks

Kirtan Patel replied to abinav shankar on 07-Nov-11 01:20 AM
if you have parent form MDI form then its not possible to do that becuase MDI main form have high Z-Order Index than the child form you opening by Button . if you are not using MDI form for parent form then you can Set Form to be Always on Top by

Me.TopMost = True

Thanks
Reena Jain replied to abinav shankar on 07-Nov-11 03:02 AM
Hi,

MenuStrip Control.

The Windows MenuStrip control provides an application menu system. The menustrip works with both Single document interfaces SDI and Multiple document interfaces MDI. With MDI applications the MenuStrip can be configured to merge with the main form for better navigation.

The new Menu of Visual Studio and the .net control set allows you to add image files to the menu structure. Interface developers can now take advantage of the new look and feel of the .net control.

Namespace: System.Windows.Forms
Assembly: Systems.Windows.Forms.dll

using System.Windows.Forms;
Calling: System.Windows.Forms.MenuStrip

Adding a MenuStrip to a Form.
Using VisualStudio, adding a MenuStrip and ToolStripMenuItem is quick and easy.

With a form open in design view, double click the MenuStrip item on the toolbox. This will add the MenuStrip control to the form. To add ToolStripMenuItem, simply start building your menu structure.

Creating MenuStrips and MenuItems have never been so easy. Visual Studio 2005 make programming and developing easy and fun. Simple put, Visual Studio 2005 is a more productive programming IDE tool.

To add a MenuStrip writing code.

Create the MenuStrip control and add it to the forms.
MenuStrip MainMenu = new MenuStrip();
this.Controls.Add(MainMenu); 

Add the File menu Item and add it to the MenuStrip above.
ToolStripMenuItem File = new ToolStripMenuItem("File"); MainMenu.Items.Add(File);

Create the New menu Items and add it to the FileMenu above. We are also going to create the click event for the item.
ToolStripMenuItem New = new ToolStripMenuItem("New");
New.Click += new EventHandler(New_Click);
File.DropDownItems.Add(New);

Create the Open menu Item and ad it to the FileMenu as you did above.
ToolStripMenuItem Open = new ToolStripMenuItem("Open");
Open.Click += new EventHandler(Open_Click);
File.DropDownItems.Add(Open);


Carry on in this manner to complete your menu structure. We now need to respond to the click events we created earlier.

void New_Click(object sender, EventArgs e) { MessageBox.Show(sender.ToString()); }
void Open_Click(object sender, EventArgs e) { MessageBox.Show(sender.ToString()); }

Hope this will help you