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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid PreferredRowHeight

Status
Not open for further replies.

mkohl

Programmer
Feb 22, 2005
82
US
I have a problem I was hoping someone could assist me in solving.

Situation: I am using a datagrid with code generated style.

Problem: During form load event the PreferredRowHeight is not being adjust to what I have set it to in the code. All other settings for the datagrid are being displayed correctly. Only the PreferredRowHeight is not loading the code generated settings.

Furthermore: I have a button that clears the datagrid. I basically create a dataset that has nothing in it, and bind it to the datagrid. After I clear the datagrid, and load new information in it, the PreferredRowHeight works properly, it just does not work during the first form load event.

Code:

'Datagrid2 settings
If Not Datagrid2.TableStyles.Contains("DataInfo") Then
'create datagrid2 table style
Dim tblStyle As New DataGridTableStyle
'properties
tblStyle.MappingName = dt.TableName
Datagrid2.TableStyles.Add(tblStyle)
tblStyle.RowHeadersVisible = False
tblStyle.HeaderBackColor = Color.Red
tblStyle.AllowSorting = False
tblStyle.HeaderForeColor = Color.White
tblStyle.GridLineColor = Color.Red
tblStyle.BackColor = Color.White
tblStyle.PreferredRowHeight = 22

'create Datagrid2 column style
Dim colStyle As GridColumnStylesCollection
colStyle = Datagrid2.TableStyles(0).GridColumnStyles
colStyle(0).Width = 100
colStyle(1).Width = 178
colStyle(2).Width = 150
colStyle(3).Width = 150
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top