|
-
Feb 9th, 2012, 02:33 PM
#1
Thread Starter
Addicted Member
Error when trying to add combobox items, Help?
Hi All,
I'm trying to add three comboboxes DAY, MONTH, YEAR to the student database column DOB.
I'm using the code:
Code:
newStudentClass.dob = CType(comboDobYear.SelectedItem & "-" & comboDobMonth.SelectedValue & "-" & comboDobDay.SelectedItem, Date)
newStudentClass.dob is a function that adds the student DOB to the SQL student database.
This code comes under the Add Student button but if i select no values in the comboboxes and click ADD i get the following error:
Conversion from string "-1-" to type 'Date' is not valid.
why is that? Most likely my coding is completely wrong
What i want is a message informing me that comboboxes need to be selected and when i do select them it converts them to date and successfully adds the info to the database.
your help will be appreciated.
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|