Advertisement

02.07.2007 at 11:48AM PST, ID: 22153673
[x]
Attachment Details

datagirdview events problem

Asked by jackjohnson44 in .Net Editors & IDEs, Microsoft Visual Basic.Net, Microsoft Visual C#.Net

Tags: datagridview, event

I have a datagridview.  I want to validate the row before letting the user do anything else (pressing a button off the grid).  I figured out how to do this.  I would like to prevent them from switching rows if the validation does not work.  I try to set the current cell to the cell that I am on in rowvalidation, but this does not work.  I can't use the e.cancel property in rowvalidate because if you press a button, it will cancel, but the focus does not go back to the grid, and you can press the button a second time.  (If that does not make sense, I am just trying to say e.cancel in rowvalidate does not work.

    Private Sub DataGridView1_RowValidating(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellCancelEventArgs) Handles DataGridView1.RowValidating
        If Len(DataGridView1.Item(DataGridView1.CurrentCell.ColumnIndex, DataGridView1.CurrentCell.RowIndex).Value) < 4 Then
            MsgBox("fail")

            Me.DataGridView1.Focus()
            DataGridView1.CurrentCell = DataGridView1.Rows(0).Cells(0)
            rowDirty = True
        Else
            rowDirty = False
        End If

    End Sub
Start Free Trial
[+][-]02.08.2007 at 08:25AM PST, ID: 18494872

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.08.2007 at 02:51PM PST, ID: 18497966

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.08.2007 at 04:03PM PST, ID: 18498341

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.09.2007 at 06:36AM PST, ID: 18501436

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.09.2007 at 07:01AM PST, ID: 18501643

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.09.2007 at 10:45AM PST, ID: 18503564

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.09.2007 at 03:35PM PST, ID: 18505361

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.12.2007 at 09:05AM PST, ID: 18516306

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.12.2007 at 03:44PM PST, ID: 18519504

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.13.2007 at 07:56AM PST, ID: 18523366

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.13.2007 at 09:59AM PST, ID: 18524461

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.13.2007 at 02:36PM PST, ID: 18526920

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.13.2007 at 04:09PM PST, ID: 18527422

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.15.2007 at 10:52AM PST, ID: 18542796

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.15.2007 at 04:09PM PST, ID: 18545128

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .Net Editors & IDEs, Microsoft Visual Basic.Net, Microsoft Visual C#.Net
Tags: datagridview, event
Sign Up Now!
Solution Provided By: Sancler
Participating Experts: 1
Solution Grade: A
 
 
[+][-]02.16.2007 at 10:11AM PST, ID: 18550492

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32