Jump to content

Making sure that all fields have been filled


Recommended Posts

I want to make sure that one of 3 radio buttons has been pressed and that a couple combos and inputs all have data in them. how might i go about this?

Thanks

<{POST_SNAPBACK}>

you can just check the state of the radio buttons and check boxes.

[quote]Randy:This is for what?! Arresting me for what?! I'm not allowed to stand up for myself?! I thought this was America! Huh? Isn't this America?! I'm sorry! I thought this was America![/quote]

Link to comment
Share on other sites

I want to make sure that one of 3 radio buttons has been pressed and that a couple combos and inputs all have data in them. how might i go about this?

Thanks

<{POST_SNAPBACK}>

Ok, I was bored...so...

#include <GUIConstants.au3>

GUICreate("My GUI combo",400,120)

$Radio1 = GUICtrlCreateRadio("One", 40, 10, 60)
$Radio2 = GUICtrlCreateRadio("Two", 40, 30, 60)
$Radio3 = GUICtrlCreateRadio("Three", 40, 50, 80)

$Combo1 = GUICtrlCreateCombo("", 200, 10, 150)
$Combo2 = GUICtrlCreateCombo("", 200, 50, 150)

$Button = GUICtrlCreateButton("Go", 140, 90, 100)

GUICtrlSetData($Combo1, "One|Two|Three")
GUICtrlSetData($Combo2, "Four|Five|Six")

GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Button
            If ErrorCheck() = 0 Then
                MsgBox(0, "Go on...", "You can do something with the data now...")
            EndIf
    EndSelect
WEnd

Func ErrorCheck()
    If GuiCtrlRead($Radio1) = 4 And GuiCtrlRead($Radio2) = 4 And GuiCtrlRead($Radio3) = 4 Then
        MsgBox(0, "Error", "You much choose one of the Radio Buttons.")
        Return(1)
    ElseIf GuiCtrlRead($Combo1) = "" Then
        MsgBox(0, "Error", "You much choose an item from the first ComboBox.")
        Return(1)
    ElseIf GuiCtrlRead($Combo2) = "" Then
        MsgBox(0, "Error", "You much choose an item from the second ComboBox.")
        Return(1)
    Else
        Return(0)
    EndIf
EndFunc

JPC :)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...