CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2001
    Location
    Utah,USA
    Posts
    11

    setting a field in datagrid as checkbox from code in VB

    hi

    Can anyone tell me the exact syntax to set a particular column in a datagrid as a checkbox from the code.

    Thankx,
    Nemani.


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: setting a field in datagrid as checkbox from code in VB

    DBGrid
    column (grid.columns(index).style = ssStyleCheckBox

    for msflexgrid you can use this code

    'on the form:
    'one flexgrid (named= flex1), 1 fixed row,2 fixed cols
    'one checkbox (named= check1) with index = 0
    Private Sub Form_Load()
    Dim intX As Integer
    Check1(0).Visible = False
    With flex1
    .Cols = 5
    .Rows = 5
    For intX = 1 To (.Rows - .FixedRows)
    Load Check1(intX)
    Check1(intX).Caption = ""
    Check1(intX).Width = 200
    Check1(intX).BackColor = .BackColor
    Check1(intX).Top = .Top + .RowHeight(intX - 1) * intX + 50
    Check1(intX).Left = .Left + .ColWidth(0) / 2
    Check1(intX).Height = .CellHeight - 20
    Check1(intX).Visible = True
    Check1(intX).ZOrder 0
    Next intX
    End With
    End Sub

    'each indexed check refers to a non fixed row
    'ie: check(1)= the first non fixed row
    'and so on
    'on the form:


    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

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

Featured