Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Read the data from Datagrid view
 

Read the data from Datagrid view

I want to read all the data from cell of datagrid and display it in say (textbox)... also if i want to read specific data from datagrid cell ....
how shall i work out with this issue please hep me........thanks
sagar_p_parakh  Sunday, February 22, 2009 3:29 PM
Hi,

If you use dataBound, you can do it like this: Bound the some data with the ListBox. This will help you display the data of a specific column in the ListBox.

private void Form2_Load(object sender, EventArgs e)

DataTable dt1 = new DataTable();

"col1");

"col2");

"aa", "11");

"bb", "22");

"aaa", "33");

"col1";

"col2";

If unbound, you need to use loop to add all the cells�data to the items of the ListBox.

Best regards,

Ling Wang


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Tuesday, February 24, 2009 6:39 AM
And you want to have the desginer in Visual Studio to show you the result?
If you like your end user to see it in YOUR program, ask in the Windows Forms Data controls forum.

MSMVP VC++
Sheng Jiang 蒋晟  Sunday, February 22, 2009 5:28 PM
actually i want to display all the data from cell of datagrid to listbox

I have used this code but it retrive the selected data from cell...... Actually i want to retrive all data from datagrid ...... so please help me
listbox.Text=Me.DataGridView1.CurrentCell.Value

sagar_p_parakh  Sunday, February 22, 2009 5:44 PM
Hi,

If you use dataBound, you can do it like this: Bound the some data with the ListBox. This will help you display the data of a specific column in the ListBox.

private void Form2_Load(object sender, EventArgs e)

DataTable dt1 = new DataTable();

"col1");

"col2");

"aa", "11");

"bb", "22");

"aaa", "33");

"col1";

"col2";

If unbound, you need to use loop to add all the cells�data to the items of the ListBox.

Best regards,

Ling Wang


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Tuesday, February 24, 2009 6:39 AM

You can use google to search for other answers

Custom Search

More Threads

• Media Player 11 Library style component
• client vs. non-client area of control
• Design-time property with no designer transactions: possible?
• Advanced Application Tracing Question
• Hide/Remove Scroll Bars on Microsoft Web Control(s)
• UserControl Property Question - Need Help
• custom windows form design
• issue on form load....with many combo boxes...
• "Find and Replace" modal dialog box is not visible in developement environment
• Can Toolstrip inherited to be changed?