简体   繁体   中英

ComboBox and Visual Basic and DataGridView

I am attempting to make a combobox that you select am/pm and my application has two comboboxes in total.

ONE combo box to select am/pm for the start time

and another to select am/pm for the end time. This is to calculate the hours worked by an employee.

I need to solve two things:

1.)How do I make sure that if I select PM for the start time the second combobox will automatically go to PM.

2.) Else if the first combo box is AM allow the second combo box to be either AM or PM

Handle the SelectedIndexChanged or SelectionChangeCommitted event of the first ComboBox and set the SelectedIndex or SelectedItem and Enabled properties of the second ComboBox appropriately. You'll want to use an If statement and choose what to do based on the SelectedIndex, SelectedItem, SelectedValue or Text of the first ComboBox.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM