Page 1 of 1
Datagridview
Posted: Tue Mar 23, 2010 8:37 pm
by marve25
i can add items to the datagridview but i can't get it from there to a textbox or two, does somebody know what i most do to make it work?
Re: Datagridview
Posted: Wed Mar 24, 2010 2:27 am
by CodenStuff
Hello marve25,
Ive not had much experience using the datagridview myself but it should work similar to a listbox or listview. How are you wanting the datagridview items transferred to a textbox?
If you want to transfer data to a textbox after selecting it in the datagridview you should be able to use:
Code: Select allTextbox.Text = DataGridView1.SelectedCells.ToString()
It depends how you want to tranfer the data?
Re: Datagridview
Posted: Wed Mar 24, 2010 6:00 pm
by marve25
no, it didnt work, its just comes System.Windows.Forms.DataGridViewSelectedCellCollection in the textbox.
i tryed TextBox1.Text = DataGridView1.SelectedRows.Item(URL) to but it either doesnt work.
if i make it work i will use it on a webbrowser like Name and URL.
Re: Datagridview
Posted: Sat Mar 27, 2010 11:55 am
by marve25
i founf it out, here is the code
Dim i As Integer
i = DataGridView1.CurrentRow.Index
TextBox1.Text = DataGridView1.Item(0, i).Value
TextBox2.Text = DataGridView1.Item(1, i).Value
TextBox3.Text = DataGridView1.Item(2, i).Value
TextBox4.Text = DataGridView1.Item(3, i).Value