472,783 Members | 1,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,783 software developers and data experts.

DataGrid Binary Column


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?


Nov 21 '05 #1
3 1160

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,

Nov 21 '05 #2

Yes, sorry -- it is a boolean column:

I have a GridStyle:

Public ReadOnly Property Analysis_Selection_Style() As DataGridTableStyle
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(TextBoxColumn(ColumnFormat.Text, "Name", 120, True))
.Add(TextBoxColumn(ColumnFormat.DateTime, "RunDate", 60,
.Add(TextBoxColumn(ColumnFormat.Text, "Peril", 60, True))
.Add(BooleanColumn("IsGroup", 60, True))
.Add(TextBoxColumn(ColumnFormat.Text, "CEDANTID", 40,
.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
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 = Nothing

mTreatyTable = New d.MyDataTable
mTreatyTable.SourceDB = g.ProjectDB
mTreatyTable.SourceTable = "dbo.mk_TreatySelections"

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


"Cor Ligthert [MVP]" wrote:

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,


Nov 21 '05 #3

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.

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Faith | last post by:
I found code on www.codeproject.com. Here is a sample it is called DataGridColumnDropDown. I modified it to use the text box when I wanted it to depended on a certain search criteria. Public...
by: John Katsaridas | last post by:
I have an old software system that is written in COBOL, and I am trying to re-engineer it to a web application on the .NET platform with C#. I want to include a DataGrid in the user interface...
by: Belee | last post by:
I have a datagrid on a windows form and I want to multiply one column by another and the result in another. For instance multiplying the price column by the quantity column and updating the...
by: pei_world | last post by:
Hi, there; I have a problem with my datagrid control. I declared it in one of my form, set with DataGridTalbeStyle as well, and when I click on button, I would like to retrive Data from Database...
by: szabelin | last post by:
Hi, I was wondering if there is a way to have a BoundColumn in DataGrid, but not display it? Basically I would like to have a primary key hidden (and I need this for edits and deletes). I know...
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
by: jaYPee | last post by:
i have successfully added a combobox to my datagrid by setting their datasource from one of my table. here's my code... Dim grdColStyle6 As New DataGridComboBoxColumn() With grdColStyle6...
by: Ron L | last post by:
I have a dataset whose source is a SQL 2k stored procedure that I am trying to display in a datagrid. This datasource has 4 columns that I am interested in here, a text column and 3 value columns...
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: lllomh | last post by:
How does React native implement an English player?
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.