Results 1 to 2 of 2

Thread: data grid header width changing

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    2

    data grid header width changing

    how to change the width of the datagrid header text ...
    and the width of the column

  2. #2
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: data grid header width changing

    VB Code:
    1. 'returns a datatable  sqlDA.Fill(ds, "DataSet")
    2.         DataGrid1.DataSource = dbMgr.getInstance.GetTableData(l_sqlstmt).Tables(0)
    3.  
    4.         Dim l_dgts As New DataGridTableStyle
    5.         l_dgts.MappingName = "DataSet"
    6.  
    7.         Dim l_aCol1 As New DataGridTextBoxColumn
    8.         Dim l_aCol2 As New DataGridTextBoxColumn
    9.         Dim l_aCol3 As New DataGridTextBoxColumn
    10.         Dim l_aCol4 As New DataGridTextBoxColumn
    11.         Dim l_aCol5 As New DataGridTextBoxColumn
    12.  
    13.         With l_aCol1
    14.             .MappingName = "GRNNum"
    15.             .HeaderText = "GRNNo"
    16.             .Width = 43
    17.         End With
    18.  
    19.         With l_aCol2
    20.             .MappingName = "GRNDate"
    21.             .HeaderText = "Date"
    22.             .Width = 65
    23.         End With
    24.  
    25.         With l_aCol4
    26.             .MappingName = "Name"
    27.             .HeaderText = "Name"
    28.             .Width = 85
    29.         End With
    30.  
    31.         With l_dgts.GridColumnStyles
    32.             .Add(l_aCol1)
    33.             .Add(l_aCol2)
    34.             .Add(l_aCol4)
    35.         End With
    36.  
    37.         If Not DataGrid1.TableStyles.Count > 0 Then
    38.             DataGrid1.TableStyles.Add(l_dgts)
    39.         End If
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width