D
Dennis T. Holm
HEy
Im having problems with setting the width of my columns of my datagrid.
Here's the code
resultatGrid.DataSource = getFirms(0) // gets metaData from database
Dim tableStyle As New DataGridTableStyle
tableStyle.PreferredColumnWidth = 100
tableStyle.RowHeadersVisible = False
tableStyle.MappingName = "firmaer"
resultatGrid.TableStyles.Clear()
resultatGrid.TableStyles.Add(tableStyle)
Dim colStyle As GridColumnStylesCollection =
resultatGrid.TableStyles(0).GridColumnStyles
colStyle.Item("FirmaID").Width = 0
colStyle.Item("Firma Navn").Width = 200
colStyle.Item("Adresse").Width = 100
colStyle.Item("Post nr").Width = 100
colStyle.Item("By").Width = 150
colStyle.Item("CVR nr").Width = 150
I get an exception when using the colStyle.Item() commands ... it should
work but it doesnt --
I get the following exceptoin: System.NullReferenceException
Object reference not set to an instance of an object ..
MVH
Dennis Holm
Im having problems with setting the width of my columns of my datagrid.
Here's the code
resultatGrid.DataSource = getFirms(0) // gets metaData from database
Dim tableStyle As New DataGridTableStyle
tableStyle.PreferredColumnWidth = 100
tableStyle.RowHeadersVisible = False
tableStyle.MappingName = "firmaer"
resultatGrid.TableStyles.Clear()
resultatGrid.TableStyles.Add(tableStyle)
Dim colStyle As GridColumnStylesCollection =
resultatGrid.TableStyles(0).GridColumnStyles
colStyle.Item("FirmaID").Width = 0
colStyle.Item("Firma Navn").Width = 200
colStyle.Item("Adresse").Width = 100
colStyle.Item("Post nr").Width = 100
colStyle.Item("By").Width = 150
colStyle.Item("CVR nr").Width = 150
I get an exception when using the colStyle.Item() commands ... it should
work but it doesnt --
I get the following exceptoin: System.NullReferenceException
Object reference not set to an instance of an object ..
MVH
Dennis Holm