Jump to content

problem with operator <>


Recommended Posts

I know... in my opinion, this is a very small error but ...

so my problem is :

$nb = InputBox ("Bon alors.... QUESTION", "Combien veux-tu de LIGNES  de ce symbole ==>> '" & $symb & "' ???" & _
        @CRLF & @CRLF & "Rep ! !, enfin marque ds la petite celule juste en dessous !","","",320,160 )
If @error = "1" Then
    Exit
EndIf


If $nb[0] <> "0" Or $nb[1] <> "1" Or $nb[2] <> "2" Or $nb[3] <> "3" Or $nb[4] <> "4" Or $nb[5] <> "5" Or _
    $nb[6] <> "6" Or $nb[7] <> "7" Or $nb[8] <> "8" Or $nb[9] <> "9" Then
    MsgBox(48,"Entrée invalide...", "Tu dois saisir un NOMBRE (chiffres de '0' à '9') et non pas des caractères !")
    Exit
EndIf

and in fact i have this error message ==>>

==> Variable used without being declared.:

If $nb[0] <> "0" Or $nb[1] <> "1" Or $nb[2] <> "2" Or $nb[3] <> "3" Or $nb[4] <> "4" Or $nb[5] <> "5" Or $nb[6] <> "6" Or $nb[7] <> "7" Or $nb[8] <> "8" Or $nb[9] <> "9" Then

If ^ ERROR

I have tryed like this :

If $nb <> "0" Or $nb <> "1" Or $nb <> "2" Or $nb <> "3" Or $nb <> "4" Or $nb <> "5" Or _
    $nb <> "6" Or $nb <> "7" Or $nb <> "8" Or $nb <> "9" Then
    MsgBox(48,"Entrée invalide...", "Tu dois saisir un NOMBRE (chiffres de '0' à '9') et non pas des caractères !")
    Exit
EndIf

But, it was the same problem, with the same error message.

Qui ose gagneWho Dares Win[left]CyberExploit[/left]

Link to comment
Share on other sites

It looks to me that you are checking for an invalid value that you specify. Consider using And instead of Or for a logical reason. Or will be true for almost any value that you give it with your previous usage.

Global $symb
$nb = InputBox("Bon alors.... QUESTION", "Combien veux-tu de LIGNES  de ce symbole ==>> '" & $symb & "' ???" & _
        @CRLF & @CRLF & "Rep ! !, enfin marque ds la petite celule juste en dessous !","","",320,160 )
If @error = 1 Then
    Exit
EndIf


If $nb <> "0" And $nb <> "1" And $nb <> "2" And $nb <> "3" And $nb <> "4" _
    And $nb <> "5" And $nb <> "6" And $nb <> "7" And $nb <> "8" And $nb <> "9" Then
    MsgBox(48,"Entrée invalide...", "Tu dois saisir un NOMBRE (chiffres de '0' à '9') et non pas des caractères !")
    Exit
EndIf

:D

Edit:

Changed a word for better meaning

Edited by MHz
Link to comment
Share on other sites

I know... in my opinion, this is a very small error but ...

so my problem is :

$nb = InputBox ("Bon alors.... QUESTION", "Combien veux-tu de LIGNES  de ce symbole ==>> '" & $symb & "' ???" & _
        @CRLF & @CRLF & "Rep ! !, enfin marque ds la petite celule juste en dessous !","","",320,160 )
If @error = "1" Then
    Exit
EndIf


If $nb[0] <> "0" Or $nb[1] <> "1" Or $nb[2] <> "2" Or $nb[3] <> "3" Or $nb[4] <> "4" Or $nb[5] <> "5" Or _
    $nb[6] <> "6" Or $nb[7] <> "7" Or $nb[8] <> "8" Or $nb[9] <> "9" Then
    MsgBox(48,"Entrée invalide...", "Tu dois saisir un NOMBRE (chiffres de '0' à '9') et non pas des caractères !")
    Exit
EndIf

and in fact i have this error message ==>>

==> Variable used without being declared.:

If $nb[0] <> "0" Or $nb[1] <> "1" Or $nb[2] <> "2" Or $nb[3] <> "3" Or $nb[4] <> "4" Or $nb[5] <> "5" Or $nb[6] <> "6" Or $nb[7] <> "7" Or $nb[8] <> "8" Or $nb[9] <> "9" Then

If ^ ERROR

I have tryed like this :

If $nb <> "0" Or $nb <> "1" Or $nb <> "2" Or $nb <> "3" Or $nb <> "4" Or $nb <> "5" Or _
    $nb <> "6" Or $nb <> "7" Or $nb <> "8" Or $nb <> "9" Then
    MsgBox(48,"Entrée invalide...", "Tu dois saisir un NOMBRE (chiffres de '0' à '9') et non pas des caractères !")
    Exit
EndIf

But, it was the same problem, with the same error message.

try this

Global $symb
$nb = InputBox("Bon alors.... QUESTION", "Combien veux-tu de LIGNES  de ce symbole ==>> '" & $symb & "' ???" & _
        @CRLF & @CRLF & "Rep ! !, enfin marque ds la petite celule juste en dessous !","","",320,160 )
If @error = 1 Then
    Exit
EndIf


If not StringRegExp ($nb ,"(\d)") Then
    MsgBox(48,"Entrée invalide...", "Tu dois saisir un NOMBRE (chiffres de '0' a '9') et non pas des caracteres !")
    Exit
EndIf

:D

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...