Converting BindingSource and Guid [solved]
-
usually in vb.net i do like this,
Dim id As Guid = DirectCast(DirectCast(Me.ABCBindingSource.Current, DataRowView)("IdABC"), Guid)
but in C# is like this,
Guid id = ((DataRowView)this.ABCBindingSource.Current)["IdABC"];
tried a lot of code to convert it to Guid and all fail. :sigh: even this way didn't works.
Guid id = Convert.ChangeType(((DataRowView)this.categoryBindingSource.Current)["IdCategory"],Guid);
Edit : omg randomly write and i got like this,
Guid id = (Guid)((DataRowView)this.categoryBindingSource.Current)["IdCategory"];
real hard to move from vb.net to c#.. :sigh:
-
usually in vb.net i do like this,
Dim id As Guid = DirectCast(DirectCast(Me.ABCBindingSource.Current, DataRowView)("IdABC"), Guid)
but in C# is like this,
Guid id = ((DataRowView)this.ABCBindingSource.Current)["IdABC"];
tried a lot of code to convert it to Guid and all fail. :sigh: even this way didn't works.
Guid id = Convert.ChangeType(((DataRowView)this.categoryBindingSource.Current)["IdCategory"],Guid);
Edit : omg randomly write and i got like this,
Guid id = (Guid)((DataRowView)this.categoryBindingSource.Current)["IdCategory"];
real hard to move from vb.net to c#.. :sigh:
Does that mean you found the solution - because the (Guid) option is the one I would have gone for first... If you solve it yourself, please edit the question and add "[Solved]" to the subject line - that way it's obvious!
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
-
Does that mean you found the solution - because the (Guid) option is the one I would have gone for first... If you solve it yourself, please edit the question and add "[Solved]" to the subject line - that way it's obvious!
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
okay, thank you.. :)
-
okay, thank you.. :)
You're welcome! :laugh:
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water