|
From: Mike on 25 Sep 2005 01:00 Hi I'm using this code to display the selected item in msgbox Dim ob As Object ob = cmbCategory.SelectedItem MsgBox(ob.ToString()) but all what I see is "System.Data.DataRowView", and the same result with cmbCategory.Text . thanks -- Regads, Rochdi
From: Mike on 25 Sep 2005 01:24 Oh, I forget the mention that the code is the ComboBox1_SelectedIndexChanged event -- Regads, Rochdi "Mike" wrote: > Hi > I'm using this code to display the selected item in msgbox > Dim ob As Object > ob = cmbCategory.SelectedItem > MsgBox(ob.ToString()) > but all what I see is "System.Data.DataRowView", and the same result with > cmbCategory.Text . > > thanks > > -- > Regads, > Rochdi
From: Phil G. on 25 Sep 2005 04:52 Try MsgBox (ComboBox1.Items(ComboBox1.SelectedIndex).ToString) HTH, Phil "Mike" <Mike(a)discussions.microsoft.com> wrote in message news:4D55F397-1F2A-4A7B-81A5-CEC98E38A830(a)microsoft.com... > Hi > I'm using this code to display the selected item in msgbox > Dim ob As Object > ob = cmbCategory.SelectedItem > MsgBox(ob.ToString()) > but all what I see is "System.Data.DataRowView", and the same result with > cmbCategory.Text . > > thanks > > -- > Regads, > Rochdi
From: Dennis on 25 Sep 2005 04:54 Your objects in the combo box are of type "System.Data.DataRowView" whose "ToString" method returns the object's type name. Also, the text placed into the combo items will be whatever the object's "ToString" method returns unless you are using binding. I believe that if you are binding the combo box to a DataView object, you need to set the ValueMember and DisplayMember properties of the combo box. Dennis in Houston "Mike" wrote: > Oh, I forget the mention that the code is the > ComboBox1_SelectedIndexChanged event > -- > Regads, > Rochdi > > > "Mike" wrote: > > > Hi > > I'm using this code to display the selected item in msgbox > > Dim ob As Object > > ob = cmbCategory.SelectedItem > > MsgBox(ob.ToString()) > > but all what I see is "System.Data.DataRowView", and the same result with > > cmbCategory.Text . > > > > thanks > > > > -- > > Regads, > > Rochdi
From: Mike on 25 Sep 2005 05:05
Yes I'm binding it to a dataset like this: cmbCategory.DataSource = Qds.Tables(0) cmbCategory.DisplayMember = "Category" where Category is the column that exist in the Qds.Table(0). but how can I set the ValueMember!!!? -- Regads, Rochdi "Dennis" wrote: > Your objects in the combo box are of type "System.Data.DataRowView" whose > "ToString" method returns the object's type name. Also, the text placed > into the combo items will be whatever the object's "ToString" method returns > unless you are using binding. I believe that if you are binding the combo > box to a DataView object, you need to set the ValueMember and DisplayMember > properties of the combo box. > > > Dennis in Houston > > > "Mike" wrote: > > > Oh, I forget the mention that the code is the > > ComboBox1_SelectedIndexChanged event > > -- > > Regads, > > Rochdi > > > > > > "Mike" wrote: > > > > > Hi > > > I'm using this code to display the selected item in msgbox > > > Dim ob As Object > > > ob = cmbCategory.SelectedItem > > > MsgBox(ob.ToString()) > > > but all what I see is "System.Data.DataRowView", and the same result with > > > cmbCategory.Text . > > > > > > thanks > > > > > > -- > > > Regads, > > > Rochdi |