Assign Values to Hidden Columns in datagrid

I have a datagrid being displayed in a tab control.  Not all columns need displayed so I have no shown them.  When entering data, there are key fields that are assigned from a "header" part of the form.  The columns are:

Job_Number
Slip_Number
SWO_Number

The user enters these values elsewhere.  When the user enters rows in the datagrid and then saves, I need each row in the grid to have the columns Job Number, Slip Number, and SWO Number to be assigned the values in the textboxes txt_Slip_Number, txt_Job_Number and txt_SWO_Number?  

Please advise.  Thanks!
LVL 1
tobin46Asked:
Who is Participating?
 
CodeCruiserConnect With a Mentor Commented:
You can handle the DataTable.TableNewRow event and add the values to the columns(this assuming that you are using a datatable/dataset as the datasource of grid)

http://msdn.microsoft.com/en-us/library/system.data.datatable.tablenewrow.aspx
0
 
PagodNaUtakCommented:
Just a clairfication datagrid or gridview?

I know you already mentioned but some people say datagrid when actually they are refering is datagridview. Datagrid and datagridview is different.
0
 
tobin46Author Commented:
@PagodNaUtak - sorry datagridview
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
tobin46Author Commented:
Maybe you could show me a sample of code that would add records to a db from a datagridview.
Columns 1, 2, 3, 4 - but Column 1 is hidden and the key and will be equal to a value in textbox_ID.
0
 
CodeCruiserCommented:
Did you try my suggestion?
0
 
tobin46Author Commented:
Just did.  Worked.  Thanks.
0
 
tobin46Author Commented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.