Datagridview

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
4 posts Page 1 of 1
Contributors
User avatar
marve25
VIP - Donator
VIP - Donator
Posts: 40
Joined: Sun Sep 20, 2009 3:47 pm

Datagridview
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?
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4392
Joined: Tue Aug 04, 2009 1:47 am

Re: Datagridview
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 all
Textbox.Text = DataGridView1.SelectedCells.ToString()
It depends how you want to tranfer the data?
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
marve25
VIP - Donator
VIP - Donator
Posts: 40
Joined: Sun Sep 20, 2009 3:47 pm

Re: Datagridview
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.
User avatar
marve25
VIP - Donator
VIP - Donator
Posts: 40
Joined: Sun Sep 20, 2009 3:47 pm

Re: Datagridview
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
4 posts Page 1 of 1
Return to “Tutorial Requests”