Toolbar keep coming out if u always press it

h0T

Member
Joined
Jun 21, 2004
Messages
15
Programming Experience
Beginner
hi everyone... can anyone tell me how to show or guide me how to show only
a form one time only as u can press many times in toolbar or contextmenu???
this is my code

PrivateSub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick

select case toolbar1.buttons.indexof(e.button)

case 0

Dim room1 AsNew Rooms
room1.Show( )

room1.mdiparent = me
case 1
Dim guest1 AsNew Guests
guest1.Show()

guest1.mdiparent = me
case 2

Dim charges1 AsNew Charges
charges1.Show()

charges1.mdiparent = me
end select
EndSub

Pls Give Me Show Guide PLs PLs PLs PLS

 

h0T

Member
Joined
Jun 21, 2004
Messages
15
Programming Experience
Beginner
Thankz again
Thankz again Paszt...
i still dont understand about wat u give me that url :confused:

Private aopen as boolean = false
private bopen as boolean = false
private copen as boolean = false

PrivateSub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick

select case toolbar1.buttons.indexof(e.button)

case 0

Dim room1 AsNew Rooms
if aopen = false then

room1.Show( )
room1.mdiparent = me
aopen = true ( so this will stop it from openin it again)

Else
*******
end if


EndSub
In this part ***** can anyone tell me how to write code to only show once only.... example is like if u press my room icon is will show (one thing )
if press second times , it will only show back the form that u just clicked???

PLs PLs Help Me



Thankz in advanced again...
Thankzz
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
In the thread that I linked to above, you first declare the form as a class member variable (out side of any procedure). Then when you click the menuItem, the code uses an If statement to check to see if the class member variable is nothing (it hasn't been created yet) or has been Disposed (disposed happens when you close the form). If it is nothing or disposed, the code creates another instance of the form. Outside of the If statement, the form is shown (using the show method).
 
Top Bottom