Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
If statement
Message
From
19/10/2004 15:32:13
 
 
To
19/10/2004 15:21:15
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00952761
Message ID:
00952770
Views:
6
>hi all,
>
>i useto write my if statment as under , any idea.new way
>
>
>if thisform.pagefram1.page1.text1.value>2 OR  thisform.pagefram1.page1.text1.value < 0
>=messagebox("hihihihi")
>else......
>
In the simplest case, WITH...ENDWITH can help:
WITH thisform.pagefram1.page1.text1
  IF .Value > 2 OR .Value < 0
    ...

  ELSE
    ...

  ENDIF

ENDWITH
More generally, what sometimes happens is you want to run code in, for example, the Text1.Valid(). So what you do is:
* Text1.Valid()

RETURN ThisForm.SomeMethod()

* ThisForm.SomeMethod()
WITH ...
* as above
ENDWITH
Instead, what you can do is pass an "object reference" to ThisForm.SomeMethod, which simplifies your code as follows:
* Text1.Valid()

RETURN ThisForm.SomeMethod(This)

* ThisForm.SomeMethod()
LPARAMETERS ;
  toTextBox

IF toTextBox.Value > 2 ...

* etc.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform