Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

preferredcolumnwidth Questions 1

Status
Not open for further replies.

jennuhw

MIS
Apr 18, 2001
426
US
I am pretty new to VB.net, so please bear with me! I have a datagrid that is linked to a datasource. This part works wonderful! The problem that I am having is that the preferredcolumnwidth setting seems to be overriding all code to change the width and the settings I put in the properties of each column. I have done msgboxs to see what the widths are, and they are what I want. The just don't show up at the correct width. Am I just missing something obvious??? Thanks, so much!
 
Had issue with settings initially in datagrid properties before I decided to set them at run time and not deign time. Here's how I do it now.

Dim ts As New DataGridTableStyle
ts.MappingName = "t_Resolution"

DataGrid1.TableStyles.Clear()

DataGrid1.TableStyles.Add(ts)
ts.GridColumnStyles(0).Width = 40
ts.GridColumnStyles(1).Width = 207
 
I have been trying that, but it never seems to change the column widths. This is what I have right now:

Dim ts As New DataGridTableStyle()
ts.MappingName = View1.Tables(0).ToString()
DataGrid1.TableStyles.Add(ts)
DataGrid1.TableStyles(0).GridColumnStyles(0).Width = 15
DataGrid1.TableStyles(0).GridColumnStyles(1).Width = 90
DataGrid1.TableStyles(0).GridColumnStyles(2).Width = 75
DataGrid1.TableStyles(0).GridColumnStyles(3).Width = 150
DataGrid1.TableStyles(0).GridColumnStyles(4).Width = 95
DataGrid1.TableStyles(0).GridColumnStyles(5).Width = 75
DataGrid1.TableStyles(0).GridColumnStyles(6).Width = 65
 
I got it! Yippee! I edited the properties of the datagrid to use the what I have it mapped to in my code. Works great! Thanks!


[ponytails]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top