DataGrid Binary Column

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
Cor,

Yes, sorry -- it is a boolean column:

I have a GridStyle:

Public ReadOnly Property Analysis_Selection_Style() As DataGridTableStyle
Get
Dim TblStyle As New DataGridTableStyle
With TblStyle
With .GridColumnStyles
Dim High As New DataGridBoolColumn
High.MappingName = "High"
High.HeaderText = "High"
High.Width = 50
High.AllowNull = False
High.ReadOnly = False
Dim Low As New DataGridBoolColumn
Low.MappingName = "Low"
Low.HeaderText = "Low"
Low.Width = 50
Low.AllowNull = False
Low.ReadOnly = False


.Add(TextBoxColumn(ColumnFormat.Dec0, "ID", 50, True))
.Add(High)
.Add(Low)
.Add(TextBoxColumn(ColumnFormat.Text, "Name", 120, True))
.Add(TextBoxColumn(ColumnFormat.DateTime, "RunDate", 60,
True))
.Add(TextBoxColumn(ColumnFormat.Text, "Peril", 60, True))
.Add(BooleanColumn("IsGroup", 60, True))
.Add(TextBoxColumn(ColumnFormat.Text, "CEDANTID", 40,
True))
.Add(TextBoxColumn(ColumnFormat.Text, "USER1", 60, True))
.Add(TextBoxColumn(ColumnFormat.Text, "USER2", 60, True))
.Add(TextBoxColumn(ColumnFormat.Text, "USER3", 60, True))
.Add(TextBoxColumn(ColumnFormat.Text, "USER4", 60, True))
End With
.AlternatingBackColor = Color.AliceBlue
End With
Return TblStyle
End Get
End Property


Private ReadOnly Property BooleanColumn(ByVal mName As String, _
ByVal mWidth As Int32, ByVal mReadOnly As Boolean) As DataGridBoolColumn
Get
Dim x As New DataGridBoolColumn
x.MappingName = mName
x.ReadOnly = mReadOnly
x.HeaderText = mName
x.Width = mWidth
x.Alignment = HorizontalAlignment.Center
Return x
End Get
End Property

Then, when the form containing the grid is loaded:
Private Sub AddAnalyses_Form_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim mGridStyles As MyGridStyles
mGridStyles = mGridStyles.Instantiate()

Dim mQuery As New d.mdb_Query("_01_06_RefreshTreatySelections")
mQuery.RunQuery()
mQuery = Nothing

mTreatyTable = New d.MyDataTable
mTreatyTable.SourceDB = g.ProjectDB
mTreatyTable.SourceTable = "dbo.mk_TreatySelections"
Me.SetUpTable(mTreatyTable)

Me.cAvailableTreatyGrid.TableStyles.Add(mGridStyles.Analysis_Selection_Style)
Me.cAvailableTreatyGrid.DataSource = 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top