eekhoorn12 Posted December 4, 2005 Share Posted December 4, 2005 How can i check if an input is empty? Link to comment Share on other sites More sharing options...
jefhal Posted December 4, 2005 Share Posted December 4, 2005 How can i check if an input is empty?$answer = InputBox("Question", "Where were you born?", "Planet Earth", "", -1, -1, 0, 0) if $answer = "" then exit ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
eekhoorn12 Posted December 4, 2005 Author Share Posted December 4, 2005 This is what i've got expandcollapse popup#include <GUIConstants.au3> $Fout = "roderondje.gif" GUICreate ( "QueueIt" , 650 , 400 ) $TITLE2 = GUICtrlCreateInput("", 15, 40, 100, 20) $groen = GUICtrlCreatePic ( "roderondje.gif" , 500, 150, 20, 20) $s_Result = 0 $q = 0 $Y = 0 GUISetState (@SW_SHOW) While 1 $s_Result = GUICtrlRead($TITLE2) $z = $Y $Y = StringLen($s_Result) if $z <> $Y then $q = 0 For $x = 1 to StringLen($s_Result) $i = StringMid($s_Result,$x,1) $a = Asc ($i) If $s_Result = " " Then GUICtrlSetImage($groen, "roderondje.gif") elseIf $a == 34 Then GUICtrlSetImage($groen, "roderondje.gif") $q = 1 elseif $a <> 34 and $q <> 1 then GUICtrlSetImage($groen, "groenrondje.gif") endif next endif Wend But it doesn't work Link to comment Share on other sites More sharing options...
Valuater Posted December 4, 2005 Share Posted December 4, 2005 maybe you could do alot of explaining so we could understand what you are trying to do.... so far this is kind of a mess 8) Link to comment Share on other sites More sharing options...
eekhoorn12 Posted December 4, 2005 Author Share Posted December 4, 2005 I'm trying to create an input which checks if the input value is correct.There are some characters than can't be written in the input. So if one of those characters is written there is picture that must turn red And when the text in the input doesn't have any of the forbidden characters it must be green But when it is empty it has to be red because it can't be empty.Hope this makes it more clear. Link to comment Share on other sites More sharing options...
Geert Posted December 4, 2005 Share Posted December 4, 2005 (edited) #include <GUIConstants.au3> GUICreate("QueueIt", 650, 400) $TITLE2 = GUICtrlCreateInput("", 15, 40, 100, 20) $StatusPic = GUICtrlCreatePic("roderondje.gif", 500, 150, 20, 20) Dim $s_Result GUISetState(@SW_SHOW) While 1 $s_Result = GUICtrlRead($TITLE2) If StringLen($s_Result) <> 0 Then; $s_Result is niet leeg If StringInStr($s_Result, '"') Then; Aanhalingsteken gevonden GUICtrlSetImage($StatusPic, "roderondje.gif") Else; Geen aanhalingsteken gevonden GUICtrlSetImage($StatusPic, "groenrondje.gif") EndIf Else; $s_Result is leeg GUICtrlSetImage($StatusPic, "roderondje.gif") EndIf WEnd Edited December 4, 2005 by Geert Link to comment Share on other sites More sharing options...
gamerman2360 Posted December 4, 2005 Share Posted December 4, 2005 'If $s_Result = " " Then' checks if it = " "(it has a space) 'If $s_Result = "" Then' checks if it = ""(empty) 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