Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / December 2004

Tip: Looking for answers? Try searching our database.

How can I catch the bool values changing in a DataGridBoolColumn?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rekha - 03 Dec 2004 16:29 GMT
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
vijai thoppae - 03 Dec 2004 19:47 GMT
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
> 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
[quoted text clipped - 12 lines]
> Thx
> rekha
Rekha - 03 Dec 2004 20:31 GMT
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

> 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
[quoted text clipped - 19 lines]
> > Thx
> > rekha

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.