?
Solved

VB 2008 - Validate datagridview DATE entry

Posted on 2009-07-04
6
Medium Priority
?
501 Views
Last Modified: 2012-05-07
User is allowed to use long or short date entry method for a Datagridview field.  The entry has to pass CellValidating.

I do not know how to test for a valid date entry.  User can enter long or short date - but it has to be valid.
0
Comment
Question by:ljcor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 24776465
How are you populating the DataGridView?

Wayne
0
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 2000 total points
ID: 24776469
If you are setting the DataSource, if the DataType of your date column is Date, a message will inform the user of an incorrect date format.

See the below example.


Wayne
Public Class Form1 
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 
        Dim dt As New DataTable
        dt.Columns.Add("Number")
        dt.Columns.Add("Date", GetType(Date)) 
        DataGridView1.DataSource = dt 
    End Sub 
    Private Sub DataGridView1_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles DataGridView1.DataError
        MsgBox(e.Exception.Message)
    End Sub 
End Class

Open in new window

0
 
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 24776475
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 7

Expert Comment

by:meispisces
ID: 24776600
Whats cell validating? Could you please explain to us


thanks
0
 

Author Comment

by:ljcor
ID: 24776883
Sorry I disappeared: this Southern California guy posted the question and then fell asleep.  Very sorry.

The grid is being populated by user data entry.

"cell validating" is the use of the Datagrid1_CellValidating event.
 
My question now: at what point in the sequence is the CellParsing event called?  Before or after the CellValidating event?
0
 

Author Closing Comment

by:ljcor
ID: 31599745
Thanks much, Wayne
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question