My code:
My goal:VB Code:
Private Sub SelectStrategy() Dim f As New Strategies.SelectStrategyfrm f.ShowDialog() If Not f.SelectedStrategy Is Nothing Then '<====no good!!! ERROR! DANGER WILL ROBINSON! ' the error is 'Is' requires operands that have ' reference types, but this operand has the value type 'Globals.StrategyStruct'. MyOptions.CurrentStrategy = f.SelectedStrategy End If f.Dispose() End Sub
The form being created prompts the user for information. If the user selects something a public structure is populated and the form closes, no problem. If however, the user selects Cancel, the public structure is set to Nothing and the form closes.
VB Code:
Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click SelectedStrategy = Nothing Me.Close() End Sub
But as you see in the first code segment, I have pointed out that I get an error.
I don't understand the error. If I can use
why can't I useVB Code:
SelectedStrategy = Nothing
and how do I propery do what I am trying to do?VB Code:
If Not f.SelectedStrategy Is Nothing Then
thanks
kevin




Reply With Quote