I have datagrid with 5 items. Out of which 1 items is checkboxe. The bool
column(checkbox column ) in added in datagrid. The rest of Data is binded
dynamically to the datagrid

Based on some values from the database I have to check or uncheck the
checkbox in the datatgrid.i have done Till check or uncheck the checkbox at
runtime in datgrid.

If the checkbox is checked at runtime then i need to get a CASEID for that
row.
Does any one know how to do this in windows form?

It would be of great help, can someone provide some idea to start with .

Thx
rekha

Re: How can I catch the bool values changing in a DataGridBoolColumn? by vijai

vijai
Fri Dec 03 13:47:33 CST 2004

try current cell changed/mouse up event to capture the click/unclick values
& generate a CaseID for that. Send me u'r sample project to this id
vijai_tm@hotmail.com so that i can figure out what's going on.

Thanks,
VJ
"Rekha" <Rekha@discussions.microsoft.com> wrote in message
news:5A62540F-0873-4A46-B43D-A28B82A9C5CD@microsoft.com...
> I have datagrid with 5 items. Out of which 1 items is checkboxe. The bool
> column(checkbox column ) in added in datagrid. The rest of Data is binded
> dynamically to the datagrid
>
> Based on some values from the database I have to check or uncheck the
> checkbox in the datatgrid.i have done Till check or uncheck the checkbox
at
> runtime in datgrid.
>
> If the checkbox is checked at runtime then i need to get a CASEID for that
> row.
> Does any one know how to do this in windows form?
>
> It would be of great help, can someone provide some idea to start with .
>
> Thx
> rekha
>



Re: How can I catch the bool values changing in a DataGridBoolColu by Rekha

Rekha
Fri Dec 03 14:31:02 CST 2004

This my code.. I want to get the CASE ID value if the checkbox is checked ...
Can u give me some idea ... thx Rekha
Private m_MyBoolColumn As Boolean

Private Function ProcessSearchQuery() As String
Dim sqlClientConnection As New SqlConnection(strConn)
Dim eblsDotNetDataAdapter As New SqlDataAdapter()
eblsDotNetDataAdapter.SelectCommand = New SqlCommand(StrSql,
sqlClientConnection)
Dim myDS As DataSet = New DataSet()

eblsDotNetDataAdapter.Fill(myDS, "MyTable")
numRecords = myDS.Tables(0).Rows.Count()
If numRecords > 0 Then
dgCases.CaptionText = "Found : " & numRecords & " matching
records."
FormSizeReset(575, 500)

Dim ts As New DataGridTableStyle()
ts.MappingName = myDS.Tables(0).TableName

Dim dc As New DataColumn("MyBoolColumn", GetType(Boolean))
dc.DefaultValue = False
myDS.Tables("MyTable").Columns.Add(dc)

Dim txtID6 As New DataGridBoolColumn()
txtID6.MappingName = "MyBoolColumn"
txtID6.HeaderText = "CHECKBOX"
txtID6.AllowNull = False
txtID6.Width = 80
ts.GridColumnStyles.Add(txtID6)


Dim txtID0 As New DataGridTextBoxColumn()
txtID0.MappingName = "caseid"
txtID0.HeaderText = "caseid"
txtID0.Width = 80
ts.GridColumnStyles.Add(txtID0)

Dim txtID As New DataGridTextBoxColumn()
txtID.MappingName = "MemberID"
txtID.HeaderText = "MemberID"
txtID.Width = 50
ts.GridColumnStyles.Add(txtID)

Dim txtID1 As New DataGridTextBoxColumn()
txtID1.MappingName = "Plan"
txtID1.HeaderText = "Plan"
txtID1.Width = 80
ts.GridColumnStyles.Add(txtID1)

Dim txtID2 As New DataGridTextBoxColumn()
txtID2.MappingName = "Retirement Date"
txtID2.HeaderText = "Retirement Date"
txtID2.Width = 80
ts.GridColumnStyles.Add(txtID2)

Dim txtID3 As New DataGridTextBoxColumn()
txtID3.MappingName = "CaseStatus"
txtID3.HeaderText = "CaseStatus"
txtID3.Width = 80
ts.GridColumnStyles.Add(txtID3)

Dim txtID4 As New DataGridTextBoxColumn()
txtID4.MappingName = "CaseDate"
txtID4.HeaderText = "CaseDate"
txtID4.Width = 80
ts.GridColumnStyles.Add(txtID4)

Dim txtID5 As New DataGridTextBoxColumn()
txtID5.MappingName = "Comments"
txtID5.HeaderText = "Comments"
txtID5.Width = 80
ts.GridColumnStyles.Add(txtID5)


dgCases.SetDataBinding(myDS, "MyTable")
dgCases.TableStyles.Clear() 'clear the contents for
second try.
dgCases.TableStyles.Add(ts)
dgCases.SetDataBinding(myDS, "MyTable")
dgCases.TableStyles(0).GridColumnStyles(1).Width = 0
End Function

Public Property MyBoolColumn() As Boolean
Get
Return m_MyBoolColumn
End Get
Set(ByVal Value As Boolean)
m_MyBoolColumn = Value
End Set
End Property
Private Sub DataGrid1_MouseUp(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles dgCases.MouseUp

Dim hti As DataGrid.HitTestInfo = Me.dgCases.HitTest(e.X, e.Y)
If hti.Column = 0 Then
dgCases.Item(hti.Row, hti.Column) = Not
CBool(dgCases.Item(hti.Row, hti.Column))
End If
End Sub


"vijai thoppae" wrote:

> try current cell changed/mouse up event to capture the click/unclick values
> & generate a CaseID for that. Send me u'r sample project to this id
> vijai_tm@hotmail.com so that i can figure out what's going on.
>
> Thanks,
> VJ
> "Rekha" <Rekha@discussions.microsoft.com> wrote in message
> news:5A62540F-0873-4A46-B43D-A28B82A9C5CD@microsoft.com...
> > I have datagrid with 5 items. Out of which 1 items is checkboxe. The bool
> > column(checkbox column ) in added in datagrid. The rest of Data is binded
> > dynamically to the datagrid
> >
> > Based on some values from the database I have to check or uncheck the
> > checkbox in the datatgrid.i have done Till check or uncheck the checkbox
> at
> > runtime in datgrid.
> >
> > If the checkbox is checked at runtime then i need to get a CASEID for that
> > row.
> > Does any one know how to do this in windows form?
> >
> > It would be of great help, can someone provide some idea to start with .
> >
> > Thx
> > rekha
> >
>
>
>