Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Whats the difference between SetFocus and SetFocus()?

Status
Not open for further replies.

kazl

Programmer
Dec 9, 2002
68
GB
Hi There

Forgive me for asking this but I am working with grids and have various places where I use SetFocus to move to a particular column control and also Refresh() the form.

In some places I have used Refresh and others Refresh()
or SetFocus / SetFocus().

What difference do the brackets () make?

Would these behave differently if I add or remove () ?

I can't seem to find any information on this, though I'm sure I've seen it somewhere.

PLEASE HELP......... been one of those weeks so far!

TIA, Kaz.
 
Kaz,

As Chris mentioned, if you are passing parameters, you need the parentheses.

You also need them if the method you are calling returns a result. For example, if you have a method called Test which returns .T. or .F., the following code will produce an error:

IF THIS.Test
* do something
ENDIF

but the following is OK:

IF THIS.Test()
* do something
ENDIF

Apart from those two cases, it won't make any difference. Some people always add the parens, as a matter of habit, whether they need it or not. Personally, I don't, but that's just me.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Hi

I wondered if the presence or absence of () was making my program misbehave. But it's just my grid code, too may things going on (as usual).

Thank you Chris and Mike for your replies.

Kaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top