I've been reading recently about passing vars between forms and all is going well with me designing my own msgbox as a trial.
Problem i have is the timing of the msgbox form disposal.
I'm using the following to hold the msgbox value...
...which is passed by the msgbox button click:
Note the 'Me.Close' as if i 'Dispose' then the value isn't returned.
So from my main form i can call like (overloaded, of course)...
...then use the return value to know which button was pressed (could be 1 - 3 buttons displayed)
However, if i call with one button, then sometime later call with two buttons then the first button is still there as the form wasn't disposed. Surely i don't have to dispose every time after i've retrieved the return value? Please help me understand further.
Problem i have is the timing of the msgbox form disposal.
I'm using the following to hold the msgbox value...
VB.NET:
Public Property MsgResult() As Object
Get
Return RVal
End Get
Set(ByVal MyVar As Object)
RVal = MyVar
End Set
End Property
...which is passed by the msgbox button click:
VB.NET:
Sub btnAClick()
Me.MsgResult = 1
Me.Close()
End Sub
Note the 'Me.Close' as if i 'Dispose' then the value isn't returned.
So from my main form i can call like (overloaded, of course)...
VB.NET:
frmMsg.ShowDialog("Confirm - Clear note?", 2, 2, "Yes, Do It", "No!!")
...then use the return value to know which button was pressed (could be 1 - 3 buttons displayed)
However, if i call with one button, then sometime later call with two buttons then the first button is still there as the form wasn't disposed. Surely i don't have to dispose every time after i've retrieved the return value? Please help me understand further.