473,409 Members | 2,063 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

validate start date is not greater then end date

I have a webpage with some textboxes and drop down lists. I have already validated to make sure that something is selected, now i want to make sure that the start date is not greater than the end date. this is the code i have for that function
Expand|Select|Wrap|Line Numbers
  1. Private Function ValidInput() As Boolean
  2.  
  3.         Dim arTextBoxes() As TextBox = {
  4.             tbShipper,
  5.             tbConsignee,
  6.             tbEnterStrtEntDate,
  7.             tbEnterEndShipDate,
  8.             tbEnterStrtShipDate,
  9.             tbEnterEndEntDate,
  10.             tbProNumber,
  11.             tbBillOfLadingNumber,
  12.             tbCheckNumber,
  13.             tbInvoiceNo
  14.         }
  15.  
  16.  
  17.         For Each tb In arTextBoxes
  18.             tb.Text = Trim(tb.Text)
  19.             If tb.Text.Length > 0 Then
  20.                 Return True
  21.             End If
  22.         Next
  23.  
  24.  
  25.  
  26.  
  27.         'if we made it here, then none of the tbs are filled in.
  28.         If ddlScacs.SelectedIndex <> 0 Then
  29.             Return True
  30.         End If
  31.         If ddlLocation.SelectedIndex <> 0 Then
  32.             Return True
  33.         End If
  34.  
  35.         If (tbEnterStrtShipDate.Text > tbEnterEndShipDate.Text) Then
  36.            FBErrMess.Visible = True
  37.             FBErrMess.Text = "Start date cannot come after end date."
  38.         End If
  39.  
  40.  
  41.         'so at this point, no tbs, no ddls used, yell at them.
  42.  
  43.         _dbmanager.ClearData()
  44.         RefreshPagers()
  45.         FBErrMess.Text = "Please enter search criteria before searching."
  46.         FBErrMess.Visible = True
  47.         Return False
  48.  
  49.     End Function
in that function, the start date and end date validation is not working at all. how do i make this work?
Oct 8 '15 #1
1 996
Luk3r
300 256MB
You should convert your date strings into dates using CDate. Something like this should help.

http://bytes.com/topic/visual-basic/...ur-datetime-vb
Oct 8 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: William Bradley | last post by:
I have two cells on a form. One of them is the "Production Date" and the other is the "Expiry Date". The "Expiry Date" is 183 days after the "Production Date." On an Excel spreadsheet, the...
7
by: CheezIt2831 | last post by:
hello, I have 5 tables(Alpha, Bravo, Charlie, Service, Trans). What i am trying to do is be able to select a start date and ending date for a report and include fields from the 5 tables. this is my...
0
by: Scott | last post by:
I have a report that summarizes attendance occurances for my team of 50 employees. Right now the date values are entered by the user before report execution. I want the start date to be...
1
by: Del | last post by:
I have a parameter query that requires the user to enter a Start Date: and End Date: and pull data between that date range. I am currently using the following parameter; Select * From mytable...
0
by: =?Utf-8?B?QW5pdGhh?= | last post by:
Hi, Currently for Announcement library a custom column "publish start date" is added and under the search result webpart changed the xslt by filtering the result based on the publish start date...
2
tuxalot
by: tuxalot | last post by:
I have a textbox, on with a record source . FrmMain is a tabbed form showing injury data for a given EmployeesID. I have a textbox, on a subform . with as the record source. is entered by a...
1
by: Charly O | last post by:
What is the best way to validate a TextBox for Date input using VBA. How to code date inputmask in vba
3
by: Jared Elyea | last post by:
I had no experience in VB before writing this so bare with me... the function below seems to work for certain cases, but not all (in some cases it is a week behind). Can anybody help me figure this...
2
by: eastbat | last post by:
Hi Everyone, I would like to create an from the in ms access form. The formula is simple :( + 3month) - (day of the start date-1day) for example: a.) if the start date is 01.01.2011 than the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.