DataGridView without databinding?

J

John Wright

I have set up a datagrid on my form with six columns. I want to capture the
data from six textboxes on the form and add them to the datagrid. All the
info I can find about this is with datatables and databinding. I don't want
to databind this, this is only a repository for data until the user clicks
the save button. Then I will iterate through the grid rows and insert the
data. Does anyone have code to populate a gridview from textboxes on a form
without databinding?

John
 
G

Guest

When the user click the button, you will put code in the button handler
similar to the following:

Dim row as Int
row = datagrid1.Rows.Add()
datagrid1.Rows(row).Cells(0).Value = TextBox1
datagrid1.Rows(row).Cells(1).Value = TextBox2
' and so on...
 
G

Guest

sorry... s/b
MyDataGridView.Rows.Add(Textbox1.Text, TextBox2.Text, ...)

the Rows.Add has an overload that takes a ParamArray of values for the
columns which I am using here.
 
J

John Wright

Thanks one and all for the help. I thought it was something along these
lines you helped fill in the blanks. I am off and running.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top