954,535 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

TextBox contents to DataGridView Cell

Hi there,

I think im trying to do something pretty simple but i can't find a simple explanation.

What i have:
I have five Textboxs (1 to 5)
I have a Button
I have a Datagrid with five columns (1 to 5)

What i want to do:
on a button click
put whatevers in the 5 textboxs in the specified columns
create another row below
and so on..

I don't know why its not a easy as:

DataGridView1.CurrentRow.Cells("Column1").Value = TextBox1

Etc, then create another row and repeat.

I'm pretty new to VB so any help would be greatly appriciated.

Cheers

Alex

Alexkid
Newbie Poster
18 posts since Apr 2007
Reputation Points: 16
Solved Threads: 0
 

See if this helps.

DataGridView1.Rows.Add(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text, TextBox5.Text)
codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
 

Thank you Codeorder, you're a legend! i new it had to be something along those lines.

Alexkid
Newbie Poster
18 posts since Apr 2007
Reputation Points: 16
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: