I figured it out. Earlier I had tried this:
objB.myCombo = CType(myCombo.SelectedValue, Int32)
but got an error (I forget just what the error was), but I've figured out
how to make this line work. In order to use 'SelectedValue', I needed to
first define the value member. So when I load data into the combo, I call
this line:
Me.myCombo.ValueMember = "ID"
Where ID is the name if the ID column in the dataset.
Now it works and compiles too when using Option Strict On.
> using vb.net 1.1 I have a combobox which I'm trying to get the selected
> item's value. the problem is that this class uses Option Explicit On and
[quoted text clipped - 13 lines]
>
> Thanks
Jeffrey Tan - 12 Sep 2004 14:38 GMT
Hi moondaddy,
I am glad you figure it out.
ComboBox.SelectedItem will return a System.Object type object, it did not
has a row(0) member, so you can not do like this.
Also, if you do not specify ValueMember for ComboBox, combobox.selectedvalue
will return null object.
Hope this helps
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.