I have the following code:
Dim RowLoopIndex As Integer
DsFuncties.Clear()
A_Functies.Fill(DsFuncties)
For RowLoopIndex = 0 To (DsFuncties.Tables("Functies").Rows.Count - 1)
If DsFuncties.Tables("Functies").Rows(RowLoopIndex).Item("FunctieID") = Func_ID Then
Func_naam = (DsFuncties.Tables("Functies").Rows(RowLoopIndex).Item("Functienaam"))
DDL_Functie.SelectedIndex = RowLoopIndex + 1
Exit For
End If
Next
Func_ID has been declared as follows:
Public Property Func_ID() As Guid
Get
If Not viewstate("Func_ID") Is Nothing Then
Return viewstate("Func_ID")
End If
End Get
Set(ByVal Value As Guid)
viewstate("Func_ID") = Value
End Set
End Property
On the red line I got the following tooltip (error):
Operator '=' is not defined for types 'System.Object' and 'System.Guid'.
How can I define '=' and eg. '&' for type System.Guid ?? Or another solution ??
Help is appreciated, Ger.This is the solution:
If DsFuncties.Tables("Functies").Rows(RowLoopIndex).Item("FunctieID").ToString() = Func_ID.ToString() Then|||The underlying issue with that exception is you're validating two separate types.
Hope this helps others too...
regards, Ger.
By converting the type System.Object to System.GUID, it would be easier to work with.
Func_ID().Equals(CType(DsFuncties.Tables("Functies").Rows(RowLoopIndex).Item("FunctieID"), GUID))
That would be a more appropriate method than to cast both into strings then evaluate.
|||Hey KraGiE, thanks for the advice.
With your help I become a rather good programmer, (I hope).
regards from the North Sea.
No comments:
Post a Comment