HELP! I don't know what happened but I've been spending sometime thinking of what could have gone wrong with my code. I'm passing a value to another form and later on use that value that is assigned to a variable.
Here is the code.
loadingPage.Show()
mode = "notime"
Dim ld As loadingPage
ld = New loadingPage()
ld.setMode(mode)
The loading page has this public sub method
Public Sub setMode(ByVal mode As String)
currentMode = mode
End Sub
After loading stuffs and it's animation, the loading page class will be calling my gameplay class
Me.Hide()
Dim gp As GamePlay
gp = New GamePlay()
gp.setMode(currentMode)
GamePlay.Show()
Then in my gameplay class I also have this public sub methos
Public Sub setMode(ByVal mode As String)
currentMode = mode
Console.WriteLine(mode + " : " + currentMode)
End Sub
Then I will be using my currentMode variable for if statements. but it seems that the currentMode does not have any value. When I try executing the console.WriteLine command at my setMode method, gameplay class there will be a values for the passing variable and the receiving variable. but when I use it at my code:
Private Sub displayInfinityIcon()
Console.WriteLine("mode = " + currentMode)
If currentMode = "notime" Then
infinityIcon.Show()
ElseIf currentMode = "withtime" Then
infinityIcon.Hide()
End If
End Sub
CurrentMode doesn't have a value. I don't know why. CurrentMode is a global variable. Help please!
Here is the code.
loadingPage.Show()
mode = "notime"
Dim ld As loadingPage
ld = New loadingPage()
ld.setMode(mode)
The loading page has this public sub method
Public Sub setMode(ByVal mode As String)
currentMode = mode
End Sub
After loading stuffs and it's animation, the loading page class will be calling my gameplay class
Me.Hide()
Dim gp As GamePlay
gp = New GamePlay()
gp.setMode(currentMode)
GamePlay.Show()
Then in my gameplay class I also have this public sub methos
Public Sub setMode(ByVal mode As String)
currentMode = mode
Console.WriteLine(mode + " : " + currentMode)
End Sub
Then I will be using my currentMode variable for if statements. but it seems that the currentMode does not have any value. When I try executing the console.WriteLine command at my setMode method, gameplay class there will be a values for the passing variable and the receiving variable. but when I use it at my code:
Private Sub displayInfinityIcon()
Console.WriteLine("mode = " + currentMode)
If currentMode = "notime" Then
infinityIcon.Show()
ElseIf currentMode = "withtime" Then
infinityIcon.Hide()
End If
End Sub
CurrentMode doesn't have a value. I don't know why. CurrentMode is a global variable. Help please!