473,387 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

DataGridView without databinding?

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
Nov 15 '07 #1
4 2993
DataGridView.Rows.Add(TextBox1, TextBox2, ....)
--
Terry
"John Wright" wrote:
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
Nov 15 '07 #2
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...
"John Wright" wrote:
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
Nov 15 '07 #3
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.
--
Terry
"Terry" wrote:
DataGridView.Rows.Add(TextBox1, TextBox2, ....)
--
Terry
"John Wright" wrote:
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

Nov 15 '07 #4
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
"Family Tree Mike" <Fa************@discussions.microsoft.comwrote in
message news:A8**********************************@microsof t.com...
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...
"John Wright" wrote:
>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

Nov 16 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jacek Jurkowski | last post by:
public class Xxx { private string tableName = "" public string TableName { get{return this.tableName;} set { if(value != null)
1
by: Ed Chiu | last post by:
Hi, Is there a way to add a row to a datagrid after DataBind method is called. I know I can call DataBind again, but that's not what I am looking for. The reason I want to do this, I have a...
2
by: Eddy Balan | last post by:
HELLLPPPPP..!!! I want to get a value from a DataSet field and putit into a textbox control but without databinding..!! Eddy
2
by: Ryan | last post by:
I want to programmatically add a row to DataGridView (a datasource was binded with it), but when I call the method DataGridView.Rows.Add, a System.InvalidOperationException will be thrown and the...
4
by: craig.wenger | last post by:
I am using a DataGridView to display information stored in classes. I am linking to the information with the Tag property of the DataGridView rows. Unfortunately, whenever I set the Tag property,...
2
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
The auto-generated line of code to fill a DataGridView once it is placed on the designer surface in VS2005 is typically: this.xyzTableAdapter.Fill(this.myDataSet.MyMember); But if the query...
2
by: Mel | last post by:
I would like to the save the column order of DataGridView. Thanks Mel
1
by: =?Utf-8?B?U2hhcm9u?= | last post by:
I'm using a DataGridView on a Form. I want to disable the clicking on the columns headers to disallow the sorting. How can I do that, but without deriving the DataGridView? Is there any other...
12
by: cj | last post by:
When viewing a datatable in a datagridview one of the columns in it is a "note" field which can be quite long. I would like to have the note field of the currently selected row of the datagrid...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.