Question Communication between forms

TheSplizz

New member
Joined
Mar 24, 2012
Messages
3
Location
Batesville, Arkansas, United States
Programming Experience
Beginner
Ok I am trying to make a game atm. I need some help adding new characters

lets say I have 2 forms one is the Start menu and the other is the GUI

I am wanting to click a button on Start menu and have a different instance of GUI open

My code that doesn't Work:
If TFA_Start.BtnAvery.Enabled Then
End If
 
Are you invoking the 2nd form through a button or something in the Main form. If so, in that button's click event write this code,

Dim frm As New Form1
frm.Show()


if the main form has mdicontainer property enables, then you need to add another line.

Dim frm As New Form1
frm.MdiParent = Me
frm.Show()
 
Are you invoking the 2nd form through a button or something in the Main form. If so, in that button's click event write this code,

Dim frm As New Form1
frm.Show()


if the main form has mdicontainer property enables, then you need to add another line.

Dim frm As New Form1
frm.MdiParent = Me
frm.Show()

(well what it is I have a starting form with 4 buttons and they are the characters in the game and what I want to do is when I press the character I want then I opens the game with the character I selected
 
hi, im not sure if this will be relevent to you but maybe it will help.

you could try and use the New method when opening the form

VB.NET:
Dim form As GUI
'Character being the variable you need to pass
        form = New GUI(Character)
        form.ShowDialog()

after doing this you can then add the following code to your 'GUI'

VB.NET:
Public Class GUI
    Dim Character As Character

   'You can then carry out what ever u need to for 
    Public Sub New(ByVal _Character As charatcer)
        Character = _Character
        InitializeComponent()
    End Sub

End Class

hope this helps :S
 
Back
Top