Hi,

I created a combobox and binded it with MS access table using following code:

this->oleDbDataAdapter1->SelectCommand->CommandText="SELECT DISTINCT Profile_Name FROM Profiles";
this->oleDbDataAdapter1->Fill(dataSet1,"Profiles");
DataTable^dt= dataSet1->Tables["Profiles"];
comboBox1->DataSource= dt;
comboBox1->DisplayMember = "Profile_Name";

I got the correct profile name I needed in the combobox. I tried it using textbox,

textBox1=comboBox1->SelectedItem->ToString();

However,it always return me "System.Data.DataRowView". How can I get the correct selected item?

Forgive me for keep spamming question as I m really working under very limited time constraint. Thanks in advance.

Recommended Answers

All 2 Replies

Haven't worked with forms etc for a while,so I might be wrong, but: textBox1->[b]Text[/b]=comboBox1->SelectedItem->ToString(); should work.

Hey even I need this. I have a combox which I binded with particular datasource. Now I want any item`s name. comboBox.items[1].Tostring() is no working.. its giving systme.data.datarowview ...
please anyone help me..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.