I have a function to show a MsgBox with a text selected from an array.
'# show the choosen message
Public Function ShowMessage(which)
ShowMessage = MsgBox(Message(which),vbyesno,"title")
end Function
The returnvalue from this function is the return value from the MsgBox itself. When I then try to ask for that value with an if-statement i get an error message saying that this is a wrong value assingment for that function.
if ShowMessage = vbYes then
MsgBox "clicked ok"
StartProgram("notepad.exe")
else
MsgBox ("some error occurred")
end if
When i assing the value of ShowMessage to var1 and go for it with the if-statement I get no error messages.
'# show the choosen message
Public Function ShowMessage(which)
ShowMessage = MsgBox(Message(which),vbyesno,"title")
var1 = ShowMessage
end Function
....
if var1 = vbYes then
MsgBox "clicked ok"
StartProgram("notepad.exe")
else
MsgBox ("some error occurred")
end if
Why can't I get access the value direct in that statement, or am I doing something wrong here?