Hi all,
I'm now getting back into vb .net after a few months doing vb6. What I want to do is the usual combo box thing- description with a hidden ID, then select the ID later.
I've read zillions of FAQs and they all say the same thing: "Itemdata is now replaced by an object! Isn't it great?" but never give me a simple example of how to do it (do you really have to write > 50 lines of code just for this??)
The clincher: Back when I did some vb .net I did a similar thing quite easily, but can't get it to work now. I populated the combo box with a dataset by:
Me.cboMeal.DataSource = dsCombo.Tables(0)
Me.cboMeal.DisplayMember = "DescField"
Me.cboMeal.ValueMember = "IDField"
Then retrieved the selected ID with
Me.cboMeal.SelectedValue
How come this worked a few months ago in another job, but won't work now?? What I get now is "Cast from type 'DataRowView' to type 'String' is not valid". If it can't resolve the selectedvalue property, what they @#$#! is it there for?
I'm now getting back into vb .net after a few months doing vb6. What I want to do is the usual combo box thing- description with a hidden ID, then select the ID later.
I've read zillions of FAQs and they all say the same thing: "Itemdata is now replaced by an object! Isn't it great?" but never give me a simple example of how to do it (do you really have to write > 50 lines of code just for this??)
The clincher: Back when I did some vb .net I did a similar thing quite easily, but can't get it to work now. I populated the combo box with a dataset by:
Me.cboMeal.DataSource = dsCombo.Tables(0)
Me.cboMeal.DisplayMember = "DescField"
Me.cboMeal.ValueMember = "IDField"
Then retrieved the selected ID with
Me.cboMeal.SelectedValue
How come this worked a few months ago in another job, but won't work now?? What I get now is "Cast from type 'DataRowView' to type 'String' is not valid". If it can't resolve the selectedvalue property, what they @#$#! is it there for?