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.
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.
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.
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!