Hey guys,
I've hit a hitch in my computing project. I want to actually create a date out of values held in combo boxes.
Now, the "Year" combo box is filled at the frmAddCustomer_Load event using this code:
At the cmbYear_SelectedIndexChanged event, the cmbMonth control is filled using:
And the cmbDay control is filled in the same way.
Now, my question is: how would one take all the individual integers (DateYearIndex, DateMonthIndex, DateDayIndex) and combine them to make a single date (dd/mm/yyyy)?
I've tried this code:
but it gives me this error:
![Posted Image]()
Could anyone shed some light on what might be happening, and how I could solve this? I'm pretty confident with VB.NET, but I've not been programming very long. Do I need to make a custom format, or is there a special process for converting integers into a date?
Thanks people!
/>/>
I've hit a hitch in my computing project. I want to actually create a date out of values held in combo boxes.
Now, the "Year" combo box is filled at the frmAddCustomer_Load event using this code:
Dim DateYearIndex As Integer
For DateYearIndex = 1900 To Today.Year
cmbYear.Items.Add(DateYearIndex)
Next
At the cmbYear_SelectedIndexChanged event, the cmbMonth control is filled using:
Dim DateMonthIndex as Integer
For DateMonthIndex = 1 To 12
cmbMonth.Items.Add(DateMonthIndex)
Next
And the cmbDay control is filled in the same way.
Now, my question is: how would one take all the individual integers (DateYearIndex, DateMonthIndex, DateDayIndex) and combine them to make a single date (dd/mm/yyyy)?
I've tried this code:
Dim Year, Month, Day As Integer
Dim DateOfBirth As New Date(Day, Month, Year)
Year = cmbYear.Text
Month = cmbMonth.Text
Day = cmbDay.Text
lblShowDate.Text = DateOfBirth
but it gives me this error:

Could anyone shed some light on what might be happening, and how I could solve this? I'm pretty confident with VB.NET, but I've not been programming very long. Do I need to make a custom format, or is there a special process for converting integers into a date?
Thanks people!