Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 149,911 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 2,158 people online right now. Registration is fast and FREE... Join Now!




control cell with Checkbox in datagridview

 
Reply to this topicStart new topic

control cell with Checkbox in datagridview

bhupinder
31 Jan, 2008 - 03:34 AM
Post #1

New D.I.C Head
*

Joined: 17 Jan, 2008
Posts: 2

Hi all rolleyes.gif ,

I have a three columns datagridview
first have checkbox, second have textbox and third is databound

if i have checked the textbox, then the user can edit the textbox and only integers should be entered in that cell in that row.

if i uncheck the checkbox, then textbox should be uneditable

I have used following code for textbox(integers only)


CODE

Private Sub DataGridView1_CellValidating(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellValidatingEventArgs) Handles DataGridView1.CellValidating
Dim dgtxtbox As DataGridViewTextBoxColumn = DataGridView1.Columns(1)
        If e.ColumnIndex = dgtxtbox.DisplayIndex Then
            If String.IsNullOrEmpty(e.FormattedValue.ToString()) Then
                Exit Sub
            End If

            If Not IsNumeric(e.FormattedValue) Then
                MsgBox("not an integer value")
                DataGridView1.CancelEdit()
            End If
        End If
    End Sub


please solve this problem

good bye
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 01:43PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month