Results 1 to 5 of 5

Thread: datagrid

  1. #1

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075

    datagrid

    I need a DataGridTableStyle to format some of the columns in my grid. I'm using the code below, but it's not working...not sure where the code goes for it to function...can someone shed some light....


    VB Code:
    1. Dim objTableStyle As DataGridTableStyle
    2.         Dim objColumn As DataGridTextBoxColumn
    3.  
    4.         objTableStyle = New DataGridTableStyle()
    5.  
    6.         objColumn = New DataGridTextBoxColumn()
    7.         objColumn.MappingName = "Col1"
    8.         objColumn.HeaderText = "First"
    9.         objTableStyle.GridColumnStyles.Add(objColumn)
    10.         intLastColumnWidth -= objColumn.Width
    11.  
    12.         objColumn = New DataGridTextBoxColumn()
    13.         objColumn.MappingName = "Col2"
    14.         objColumn.HeaderText = "Second"
    15.         objTableStyle.GridColumnStyles.Add(objColumn)
    16.         intLastColumnWidth -= objColumn.Width
    It's tough being an unhandled exception...

    ___________
    VB.NET 2008
    VB.NET 2010
    ORACLE 11g
    CRYSTAL 11

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Did you define the datagird datasource?
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  3. #3

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    I got it working...thanks Lun

    one of the fields in my grid is a date, but it's coming over with the time...you know how I can format this?
    It's tough being an unhandled exception...

    ___________
    VB.NET 2008
    VB.NET 2010
    ORACLE 11g
    CRYSTAL 11

  4. #4
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Not tested but may be this helps:
    VB Code:
    1. Me.DataGridTextBoxColumn1.Format = "d" ' d stands for short date format

    Or you may use other custom format strings.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  5. #5

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    sweet...it worked!


    VB Code:
    1. Dim grdColStyle2 As New DataGridTextBoxColumn()
    2.         With grdColStyle2
    3.             .HeaderText = "Purchase Date"
    4.             .MappingName = "purchase_date"
    5.             .Alignment = HorizontalAlignment.Center
    6.             .ReadOnly = True
    7.             .Format = "d"
    8.         End With
    It's tough being an unhandled exception...

    ___________
    VB.NET 2008
    VB.NET 2010
    ORACLE 11g
    CRYSTAL 11

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