|
-
Aug 31st, 2010, 11:45 PM
#1
Thread Starter
Lively Member
how to insert values into datagrid
how to insert values into datagrid, please help me with sample code
-
Sep 1st, 2010, 12:00 AM
#2
Re: how to insert values into datagrid
You're going to have to provide a much more complete explanation of what you're doing than that. We could guess, but if we guess wrong then you've wasted our time and yours. Please always provide a full and clear description of the problem.
-
Sep 1st, 2010, 12:08 AM
#3
Thread Starter
Lively Member
Re: how to insert values into datagrid
have 10 textbox , 1 datgrid, 1 button control in my form,
after entering values in my all textbox i need to insert that values in my datagrid though button click event
please give me sample code for this
-
Sep 1st, 2010, 12:29 AM
#4
Re: how to insert values into datagrid
Does the grid contain data already? Where did the data come from? If you're adding data to a database then it would make most sense to use a DataTable bound to both the grid and the TextBoxes.
-
Sep 1st, 2010, 12:35 AM
#5
Thread Starter
Lively Member
Re: how to insert values into datagrid
data grid does not have value already, after giving input in all textbox in need to insert that all values in datagrid
-
Sep 1st, 2010, 01:16 AM
#6
Re: how to insert values into datagrid
So, the data is NOT going to be saved to a database?
-
Sep 1st, 2010, 01:19 AM
#7
Thread Starter
Lively Member
Re: how to insert values into datagrid
-
Sep 1st, 2010, 02:10 AM
#8
Re: how to insert values into datagrid
In that case, you can do something like this:
vb.net Code:
myDataGridView.Rows.Add(New Object() {Me.TextBox1.Text, Me.TextBox2.Text, Me.TextBox3.Text})
Obviously you need to specify the correct number of TextBoxes in the correct order for the columns in your grid.
-
Sep 1st, 2010, 07:42 AM
#9
Thread Starter
Lively Member
Re: how to insert values into datagrid
i am getting error as
No row can be added to a DataGridView control that does not have columns. Columns must be added first.
-
Sep 1st, 2010, 08:03 PM
#10
Re: how to insert values into datagrid
I would hope that that error message would speak for itself.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|