Hi guys

I came to a dead end writing a program for one of my friends,

I cant seem to get data in my datagridview to show in my textbox.
can anyone please assist?

I need to make a invoice in the multiline textbox with data in my datagrid view

thanks

Recommended Answers

All 2 Replies

How do you intend to pass the data from DGV to textBox? On a row (cell) click?
Some other way?
If so, do it like:

textBox1.Text = dgv[ColumnIndex, RowIndex].Value.ToString();

if you want to add data to textBox (multiline) use += insted of = only and add "\r\n" before code:

textBox1.Text += dgv[ColumnIndex, RowIndex].Value.ToString() + "\r\n"; //for adding new line for next insert
commented: nice +1

Thanks. Did the second way you told me and worked great.

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.