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