DataGrid Binary Column

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Art

    #1

    DataGrid Binary Column

    Hi,

    I need some advice with a binary column in a DataGrid. Everything seems
    fine except for one thing. In order to check a box, I have to click on it
    once to select it, and then click again to check it. Somehow this doesn't
    seem right. Does anyone know if this is normal behavior for a DataGrid, of if
    there's something I need to know?

    thanks,

    Art
  • Cor Ligthert [MVP]

    #2
    Re: DataGrid Binary Column

    Art,

    I assume that you mean a boolean column. I did test it and had not your
    behaviour. Can you tell tell us how you made that column

    I hope this helps something,

    Cor


    Comment

    • Art

      #3
      Re: DataGrid Binary Column

      Cor,

      Yes, sorry -- it is a boolean column:

      I have a GridStyle:

      Public ReadOnly Property Analysis_Select ion_Style() As DataGridTableSt yle
      Get
      Dim TblStyle As New DataGridTableSt yle
      With TblStyle
      With .GridColumnStyl es
      Dim High As New DataGridBoolCol umn
      High.MappingNam e = "High"
      High.HeaderText = "High"
      High.Width = 50
      High.AllowNull = False
      High.ReadOnly = False
      Dim Low As New DataGridBoolCol umn
      Low.MappingName = "Low"
      Low.HeaderText = "Low"
      Low.Width = 50
      Low.AllowNull = False
      Low.ReadOnly = False


      .Add(TextBoxCol umn(ColumnForma t.Dec0, "ID", 50, True))
      .Add(High)
      .Add(Low)
      .Add(TextBoxCol umn(ColumnForma t.Text, "Name", 120, True))
      .Add(TextBoxCol umn(ColumnForma t.DateTime, "RunDate", 60,
      True))
      .Add(TextBoxCol umn(ColumnForma t.Text, "Peril", 60, True))
      .Add(BooleanCol umn("IsGroup", 60, True))
      .Add(TextBoxCol umn(ColumnForma t.Text, "CEDANTID", 40,
      True))
      .Add(TextBoxCol umn(ColumnForma t.Text, "USER1", 60, True))
      .Add(TextBoxCol umn(ColumnForma t.Text, "USER2", 60, True))
      .Add(TextBoxCol umn(ColumnForma t.Text, "USER3", 60, True))
      .Add(TextBoxCol umn(ColumnForma t.Text, "USER4", 60, True))
      End With
      .AlternatingBac kColor = Color.AliceBlue
      End With
      Return TblStyle
      End Get
      End Property


      Private ReadOnly Property BooleanColumn(B yVal mName As String, _
      ByVal mWidth As Int32, ByVal mReadOnly As Boolean) As DataGridBoolCol umn
      Get
      Dim x As New DataGridBoolCol umn
      x.MappingName = mName
      x.ReadOnly = mReadOnly
      x.HeaderText = mName
      x.Width = mWidth
      x.Alignment = HorizontalAlign ment.Center
      Return x
      End Get
      End Property

      Then, when the form containing the grid is loaded:
      Private Sub AddAnalyses_For m_Load(ByVal sender As Object, _
      ByVal e As System.EventArg s) Handles MyBase.Load
      Dim mGridStyles As MyGridStyles
      mGridStyles = mGridStyles.Ins tantiate()

      Dim mQuery As New d.mdb_Query("_0 1_06_RefreshTre atySelections")
      mQuery.RunQuery ()
      mQuery = Nothing

      mTreatyTable = New d.MyDataTable
      mTreatyTable.So urceDB = g.ProjectDB
      mTreatyTable.So urceTable = "dbo.mk_TreatyS elections"
      Me.SetUpTable(m TreatyTable)

      Me.cAvailableTr eatyGrid.TableS tyles.Add(mGrid Styles.Analysis _Selection_Styl e)
      Me.cAvailableTr eatyGrid.DataSo urce = mTreatyTable

      I think that's about it. While you're at it (should you decide to read
      through all of my stuff -- which I again appreciate: I would like to capture
      data entry in a text box (another grid). Basically I want to divide by 100
      when the user makes an entry since he will be entering a percentage. Can I
      do this?

      Thank you very much for helping

      Art

      "Cor Ligthert [MVP]" wrote:
      [color=blue]
      > Art,
      >
      > I assume that you mean a boolean column. I did test it and had not your
      > behaviour. Can you tell tell us how you made that column
      >
      > I hope this helps something,
      >
      > Cor
      >
      >
      >[/color]

      Comment

      • Cor Ligthert [MVP]

        #4
        Re: DataGrid Binary Column

        Art,

        It is difficult to read, however if you need a column divided by 100 than
        why not use an expression.



        Or maybe this one



        I did not use styles with this, however that can of course as well.

        Cor


        Comment

        Working...