0

I have one MonthCalendar and a list box.
list box contain the time for appointment and monthcalendar is used for chosing the date.
My listbox item(eg:8am) will be deleted when an appointment is made on 15 July 2012.
I want my listbox change to another when the date in month calendar change.
Is it possible to do it??
or any better suggestion
My system enable user to make appointment.
If an appointment is canceled, the time will add back into the list box of the day.

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Begginnerdev
0

Are you using a DateTimePicker control?

If so, you can make use of the ValueChanged event.

If you listbox has multiple values, reference the value you want to change first.

Example:

Private selectedItem As Object 'Define your data type here'
'Example: selectedItem as Date'

Private Sub ListBox1_Click(sender As System.Object, e As System.EventArgs) Handles ListBox1.Click
    selectedItem = ListBox1.SelectedItem
    'Example with typed data: selectedItem = Cdate(ListBox1.SelectedItem)'
End Sub

Now, just change the value of the selected item when the user changes the value on the date time picker.

Example:

Private Sub DateTimePicker1_ValueChanged(sender As System.Object, e As System.EventArgs) Handles DateTimePicker1.ValueChanged
    selectedItem = DateTimePicker1.Value
    'Remember to handle the data types, if you are using string make sure to use the .ToString function ect...'
End Sub

Hope this helps!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.