dumou8343 Posted September 23, 2016 Share Posted September 23, 2016 Hey guys, I'm currently working on this little program that helps people at my work make IT requests, everything is working nice and pollished except for one error handelling I can't seem to figure out. I have 2 combo box $CBDebut = GUICtrlCreateCombo("", 312, 112, 137, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "8:00|8:30|9:00|9:30|10:00|10:30|11:00|11:30|12:00|12:30|13:00|13:30|14:00|14:30|15:00|15:30|16:00|16:30|17:00|17:30", "8:00") $CBFin = GUICtrlCreateCombo("", 312, 176, 137, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "8:00|8:30|9:00|9:30|10:00|10:30|11:00|11:30|12:00|12:30|13:00|13:30|14:00|14:30|15:00|15:30|16:00|16:30|17:00|17:30", "12:00") So the goal with this is people can reserve our conference rooms, but If they select 10:00 on $CBDebut and 9:00 on $CBFin it sould give me an error since they can only schedule the room for 1 day at a time, so I need to make sure that the first combo is always smaller then the second one. but since its not numerical value I can't figure it out. If the :30 cauz a problem I could remove them, but I would like for it to say. Thank you guys for the help! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 23, 2016 Moderators Share Posted September 23, 2016 dumous8343, I would do something like this: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <GuiComboBox.au3> $sList = "8:00|8:30|9:00|9:30|10:00|10:30|11:00|11:30|12:00|12:30|13:00|13:30|14:00|14:30|15:00|15:30|16:00|16:30|17:00|17:30" $hGUI = GUICreate("Test", 500, 500) $CBDebut = GUICtrlCreateCombo("", 10, 10, 137, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $sList, "8:00") $CBFin = GUICtrlCreateCombo("", 10, 50, 137, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $sList, "12:00") $cRead = GUICtrlCreateButton("Read", 10, 100, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cRead $iIndex_Debut = _GUICtrlComboBox_FindString($CBDebut, GUICtrlRead($CBDebut)) $iIndex_Fin = _GUICtrlComboBox_FindString($CBFin, GUICtrlRead($CBFin)) If $iIndex_Debut < $iIndex_Fin Then MsgBox($MB_SYSTEMMODAL, "Booking", "Accepted") Else MsgBox($MB_SYSTEMMODAL, "Error", "End must be after start") EndIf EndSwitch WEnd As long as the 2 combos have identical contents this will work. M23 dumou8343 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
dumou8343 Posted September 23, 2016 Author Share Posted September 23, 2016 Wow this works perfectly! Thank you very much I will modify it to fit my needs! you are a superhero! good weekend to you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now