How to Formatting in DataGridView The DataGridView control is highly configurable and extensible, and it provides many properties, methods, and events to. The Merge method will add the rows of the source table to the destimation table one by one. Consequently, autonumber column values are generated as sequential row numbers. In a few minutes, we will create a Windows Forms Application to test the case. Create a Windows Form and add a DataGridView.
Apr 11, 2012OS: windows 7 64-bit /Programming Language: Visual Basic.net on Visual Studio 2010 express edition.I have dataset with 4 tables each one of them is a datasource to a datagridview I want to add a serial number column to the datagridview so I made this
DataGridView1.Columns.Add('serial', 'SER.')
For x As Integer = 0 To (ds.Tables('workers').Rows.Count - 1)
DataGridView1('serial', x).Value = (x + 1)
Next
It was working fine untill I added a relationship to the dataset the relationships codes were
Dim relation_WC As New DataRelation('relation_WC', ds.Tables('workers').Columns('id'), ds.Tables('cources_jun').Columns('workerid'))
Dim relation_WV As New DataRelation('relation_WV', ds.Tables('workers').Columns('id'), ds.Tables('vacations_jun').Columns('workerid'))
[code]....
I breaked point the debuging and I found that the serial number column I added is fine and has it's values, but when I reach the line relations.add(the_relation) the serial number column loses it's values and turn into an empty column with no
numbers in it....why this is happening?
Note: I added another relations but the only relations that clear the serial number column are the relations that has a datatable that is a datasource to the datagridview that has the serial number column.
Apr 11, 2012DataGridView1.Columns.Add('serial', 'SER.')
For x As Integer = 0 To (ds.Tables('workers').Rows.Count - 1)
DataGridView1('serial', x).Value = (x + 1)
Next
It was working fine untill I added a relationship to the dataset the relationships codes were
Dim relation_WC As New DataRelation('relation_WC', ds.Tables('workers').Columns('id'), ds.Tables('cources_jun').Columns('workerid'))
Dim relation_WV As New DataRelation('relation_WV', ds.Tables('workers').Columns('id'), ds.Tables('vacations_jun').Columns('workerid'))
[code]....
I breaked point the debuging and I found that the serial number column I added is fine and has it's values, but when I reach the line relations.add(the_relation) the serial number column loses it's values and turn into an empty column with no
numbers in it....why this is happening?
Note: I added another relations but the only relations that clear the serial number column are the relations that has a datatable that is a datasource to the datagridview that has the serial number column.
![Using datagridview vb Using datagridview vb](https://i.ytimg.com/vi/4gjYikLR_CI/hqdefault.jpg)
OS: windows 7 64-bit /Programming Language: Visual Basic.net on Visual Studio 2010 express edition.I have dataset with 4 tables each one of them is a datasource to a datagridview I want to add a serial number column to the datagridview so I made this
DataGridView1.Columns.Add('serial', 'SER.')
For x As Integer = 0 To (ds.Tables('workers').Rows.Count - 1)
DataGridView1('serial', x).Value = (x + 1)
Next
It was working fine untill I added a relationship to the dataset the relationships codes were
Dim relation_WC As New DataRelation('relation_WC', ds.Tables('workers').Columns('id'), ds.Tables('cources_jun').Columns('workerid'))
Dim relation_WV As New DataRelation('relation_WV', ds.Tables('workers').Columns('id'), ds.Tables('vacations_jun').Columns('workerid'))
[code]....
I breaked point the debuging and I found that the serial number column I added is fine and has it's values, but when I reach the line relations.add(the_relation) the serial number column loses it's values and turn into an empty column with no
numbers in it....why this is happening?
Note: I added another relations but the only relations that clear the serial number column are the relations that has a datatable that is a datasource to the datagridview that has the serial number column.
DataGridView1.Columns.Add('serial', 'SER.')
For x As Integer = 0 To (ds.Tables('workers').Rows.Count - 1)
DataGridView1('serial', x).Value = (x + 1)
Next
It was working fine untill I added a relationship to the dataset the relationships codes were
Dim relation_WC As New DataRelation('relation_WC', ds.Tables('workers').Columns('id'), ds.Tables('cources_jun').Columns('workerid'))
Dim relation_WV As New DataRelation('relation_WV', ds.Tables('workers').Columns('id'), ds.Tables('vacations_jun').Columns('workerid'))
[code]....
I breaked point the debuging and I found that the serial number column I added is fine and has it's values, but when I reach the line relations.add(the_relation) the serial number column loses it's values and turn into an empty column with no
numbers in it....why this is happening?
Note: I added another relations but the only relations that clear the serial number column are the relations that has a datatable that is a datasource to the datagridview that has the serial number column.