Jump to content
youtuber

If two entries are empty - error?

Recommended Posts

youtuber

What can I do for the error message if the two entries are empty?

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 178, 195)
$Button1 = GUICtrlCreateButton("Button1", 48, 128, 75, 25)
$Input1 = GUICtrlCreateInput("", 32, 16, 121, 21)
$Input2 = GUICtrlCreateInput("", 32, 64, 121, 21)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

            Case $Button1
If (GUICtrlRead($Input1,$Input2) == "") Then
                MsgBox(48, "Error", "Do not leave it empty!")
            Else
MsgBox(0, "Successful", "Both inputs full")
            EndIf

    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites
iamtheky
If guictrlread($input1) = "" AND guictrlread($input2) = ""

something like that

  • Like 1

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
youtuber

One does not give an error if one is full

If guictrlread($input1) = "" AND guictrlread($input2) = "" Then
                MsgBox(48, "Error", "Do not leave it empty!")
            Else
MsgBox(0, "Successful", "Both inputs full")
            EndIf

 

Share this post


Link to post
Share on other sites
iamtheky

True, because they both have to be blank with AND.  If you want to error if either is blank the operator should be OR.

  • Like 1

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
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

×