hey guys how i display datagridview cell values in a listbox once i click on it
heres what i have so far but it doesnt work

private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {

          listBox1.Text = dataGridView1.Rows[e.RowIndex].Cells["Description"].Value.ToString();

        }

please help thanks in advanced

Recommended Answers

The Listbox.Text property is used to Search for specific text. So what you are actually doing is searching the listbox for dataGridView1.Rows[e.RowIndex].Cells["Description"].Value.ToString(); the method george suggested will work.

Jump to Post

All 2 Replies

try this

listBox1.Items.Add( dataGridView1.Rows[e.RowIndex].Cells["Description"].Value.ToString());

The Listbox.Text property is used to Search for specific text. So what you are actually doing is searching the listbox for dataGridView1.Rows[e.RowIndex].Cells["Description"].Value.ToString(); the method george suggested will work.

Be a part of the DaniWeb community

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