469,627 Members | 1,098 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,627 developers. It's quick & easy.

DataGrid Binary Column

Art
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
Nov 21 '05 #1
3 1075
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
Nov 21 '05 #2
Art
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(mGridStyle s.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

"Cor Ligthert [MVP]" wrote:
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

Nov 21 '05 #3
Art,

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

http://www.vb-tips.com/default.aspx?...3-a3539697edbd

Or maybe this one

http://www.vb-tips.com/default.aspx?...8-1def3152436f

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

Cor
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Faith | last post: by
1 post views Thread by John Katsaridas | last post: by
2 posts views Thread by Belee | last post: by
6 posts views Thread by szabelin | last post: by
2 posts views Thread by CSL | last post: by
6 posts views Thread by Ron L | last post: by
2 posts views Thread by =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.