Private Sub mnuedit_Click()
intWhich = 1 'The Browser knows to open the edit menu after choosing a file
frmBrowse.Show
End Sub
Private Sub mnuload_Click()
intWhich = 0 'The Browser knows not to open the edit menu after choosing a file
frmBrowse.Show
End Sub
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case Is = 0
strProfile = File1.Path & "\" & File1.FileName
If intWhich = 0 Then
Unload Me
ElseIf intWhich = 1 Then
Call Load
frmSetup.Show
Unload Me
Else
MsgBox "?"
End If
Case Is = 1
Unload Me
End Select
End Sub
in my modDeclare Module.
'Random Variables
Dim intWhich As Integer
For some reason no matter what I do I get the "?" message box, I originally though maybe you were unable to use nested case statements, but when I switched to an if statement I came up with the same error, so I changed my Which variable from an int to a string and it still does not work. If someone could help me It would be much appreciated.
Um, are you declaring a variable in the global/form scope named "strWhich" ?
Additonally why are you storing numerical data as a string?
Just declare the global variable as an integer.
yes strWhich is declared globally, and it was initally declared as an int, but for some reason or another that did not work either so I changed it to a string to see if that would make it work.
#Edit
I have now replaced strWhich with intWhich and now intwhich is never given a value and simplly closes frmbrowse.
The code from the first post has been changed to match the current situation.
Quote from: Forged
intwhich is never given a value and simplly closes frmbrowse.
Figure out why it's not being given a value. Are your methods being called?
there is no reason for it to not to be given a value, I even added intwhich = 4 in frmBrowse on form_load
still acts like the value is 0
add Option Explicit at the top of the code and make sure your variable is global.
works fine after adding Option Explicit, thank you sir.
No problem