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

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.