Main Menu help

  • Thread starter Thread starter Yuvaraj
  • Start date Start date
Y

Yuvaraj

while using menu in vb net if i clicked on one o the menu the form
will be displayed. after that if i again clicked on that menu item i
dont want to display the same window again.
 
while using menu in vb net if i clicked on one o the menu the form
will be displayed. after that if i again clicked on that menu item i
dont want to display the same window again.

Are you saying that on a menu click you display a new instance of a
form?

If so you can just do this in the click handler:

///////////////////
Dim f As New Form1()
f.Show()
///////////////////

That will create a new Form1 every time it's called, and not just show
the same one on subsequent clicks.

Thanks,

Seth Rowe [MVP]
 
Yuvaraj said:
while using menu in vb net if i clicked on one o the menu the form
will be displayed. after that if i again clicked on that menu item i
dont want to display the same window again.

Seth's answer is probably right, but if you want to make a single form and
activate it when the menu item is hit a second time, hold onto the instance
of the form object in your class. On the second menu hit, just issue:
form1.Activate(). I guess you should also make sure it is visible first...
 
Set a static or global boolean variable=false. When it is hit first,
make it true and call the form. When it is true, don't call the form up
again.

Mike
 
Back
Top