0
Reply

Button help please

stuslaptop

stuslaptop

Mar 23 2004 2:20 PM
1.1k
I am building a test rpg in Vb.net and am in the middle of building the GUI. I managed to get my buttons to open and close a form with the same button. I used Static as when I draged and droped the new form and pressed the button again with Dim it created a new instance and I only wanted one. Now this works fine but when I press another button so for example I have the player bag and inventory open at the same time as expected they both open. If I press the bag button to close just the bag the inventory and bag both close, upon pressing the bag button again both inventory and bag open once more. Also if I press another button all open forms close I do not want them to. Public Shared btnInventroyShow As Boolean = False Public Shared btnBagShow As Boolean = False Private Sub btnGuiInventory_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuiInventory.Click Static formInventoryShow As New Inventory If btnInventroyShow = False Then btnInventroyShow = True formInventoryShow.Show() Else btnInventroyShow = False formInventoryShow.Hide() End If End Sub Private Sub btnGuiBag_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuiBag.Click Static formBagShow As New Bag If btnBagShow = False Then btnBagShow = True formBagShow.Show() Else btnBagShow = False formBagShow.Hide() End If End Sub http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/mdiappsmenus.asp

Next Recommended Forum