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!

Datagrid dynamic Columns - change style

Status
Not open for further replies.

KnotGoblin

Technical User
Jan 4, 2005
77
US
I am addimg columns dynamically to a datgrid and I want to change the item style for the new column i am creating, but i am not sure how do so.

Here is an example of how I am adding the new columns.

Code:
Function newDGcolumn(ByVal name As String, ByVal field As String) As DataGridColumn
        Dim newColumn = New BoundColumn
        newColumn.HeaderText = name
        newColumn.DataField = field
        Return newColumn
End Function

Me.myDataGrid.Columns.Add(newDGColumn("New", "myData"))
 
I have figured out that can change the ItemStyle property.
For example, this changes the horizontal alignment to center:
Code:
newColumn.ItemStyle.HorizontalAlign=2

as you can see it is looking for an integer not a string.

and on that note I will extend my question:
how can i find out the possible integer values for these properties?
 
0 = NotSet
1 = Left
2 = Center
3 = Right
4 = Justify

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
just figured out that there is a HorizontalAlign class.

so:
HorizontalAlign.Left
HorizontalAlign.Right
etc.

Thanks anyway, checkai
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top