473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 1189
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
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...
1
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...
2
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...
8
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...
6
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...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
5
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...
6
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...
2
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.