Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 To: Adam Nurrohman
  Where is Adam Nurrohman?
 Sindanglaut
 Indonesia
 Adam Nurrohman
 Tags
Subject: RE: error 1929. THISFORM can onl be used within a method
Thread ID: 112601 Message ID: 113282 # Views: 3 # Ratings: 0
Version: Visual FoxPro 9 Category: Errors & Debugging
Date: Thursday, November 16, 2006 6:18:54 PM         
   


> > > > > Hi,
> > > > > Does anyone ever find error 1929? THISFORM can onl be used within a method. Does anyone have the solution for this error? Thank you.
> > > > >
> > > > > regards
> > > > >
> > > > > Adam N

> > > >
> > > > Adam,
> > > >
> > > > This, ThisForm, and ThisFormSet all need to be run from a method. If you think about it for a bit you will realise that ThisForm actually refers to This Form. Not another form or a form on the _Screen, but This form. In other words VFP has to be able to evaluate which form you mean when you reference ThisForm. Now if you are attempting to use ThisForm from within an external .PRG or from a stored procedure, etc. VFP will attempt to find this form and only find that procedure or .prg - not a form. The same rules apply to This and ThisFormSet.
> > > >
> > > > If you use ThisForm from within a form, where will you use it? It won't be in a property, it will have to be in a method or event in that form. The error message is not really accurate though. You can use ThisForm in an event as well - you would have to. The basic rule is "Put procedural code in a method and call that method from an event." For example, in the .Click() event of a command button you might have ThisForm.SomeMethod(Param1, Param2, ..., ParamN).
> > > >
> > > > Where are you using ThisForm to get this error?
> > > >
> > > > Ken
> > > > You shall know the truth - and the truth shall set you free. (John 8:33)

> > >
> > >
> > >
> > > It's in the activate event. I suspect it is because the use of
> > > set filer to. It's been twice I get this error and
> > > both are caused by the use of it.
> > >
> > > Regards
> > >
> > > Adam N

> >
> > Adam,
> >
> > Please post the offending code.
> >
> > Ken
> > You shall know the truth - and the truth shall set you free. (John 8:33)

>
> Hi Ken,
> Here is the offending code. It is in the activate event of the form.
>
>
> SELECT t_kel
> SET ORDER TO kd_kel
> 
> SELECT t_skel
> SET ORDER TO kd_skel
> 
> SELECT t_skel
> SET RELATION to
> SET RELATION TO kd_kel INTO t_kel
> SET FILTER TO ALLTRIM(kd_kel) = ALLTRIM(thisform.pageframe1.page4.text3.value)
> 
> thisform.pageframe1.page4.grid1.readonly= .T.
> thisform.pageframe1.page4.grid1.RecordSourceType= 1 
> thisform.pageframe1.page4.grid1.RecordSource="t_skel"
> thisform.pageframe1.page4.grid1.ColumnCount=2
> 
> thisform.pageframe1.page4.grid1.column1.ControlSource="kd_skel"
> thisform.pageframe1.page4.grid1.column1.Width=75
> thisform.pageframe1.page4.grid1.column1.Alignment= 2
> thisform.pageframe1.page4.grid1.column1.Header1.Caption="Kode"
> thisform.pageframe1.page4.grid1.column1.Header1.Fontsize=8
> thisform.pageframe1.page4.grid1.column1.Header1.Alignment= 2
> thisform.pageframe1.page4.grid1.column1.Header1.FontBold=.t.
> thisform.pageframe1.page4.grid1.column1.Header1.backcolor=RGB(204,236,255)
> 
> thisform.pageframe1.page4.grid1.column2.ControlSource="ur_skel"
> thisform.pageframe1.page4.grid1.column2.Width=646
> thisform.pageframe1.page4.grid1.column2.Alignment= 0
> thisform.pageframe1.page4.grid1.column2.Header1.Caption="Uraian Sub Kelompok Barang"
> thisform.pageframe1.page4.grid1.column2.Header1.Fontsize=8
> thisform.pageframe1.page4.grid1.column2.Header1.Alignment= 2
> thisform.pageframe1.page4.grid1.column2.Header1.FontBold=.t.
> thisform.pageframe1.page4.grid1.column2.Header1.backcolor=RGB(204,236,255)
> thisform.pageframe1.page5.grid1.click()
> 
> 

>
> Thank you.
>
>
> Regards
>
>
> Adam N


Adam,

Nothing jumps out at me, but I would suggest that this code should be placed in it's own method. Create a custom form method and cut and paste the code out of the .Activate() event. Now call that method from the .Activate(). Procedure goes in methods. You call methods from events.

Which line causes the error?

Ken
You shall know the truth - and the truth shall set you free. (John 8:33)

ENTIRE THREAD

error 1929. THISFORM can onl be used within a method Posted by Adam Nurrohman @ 11/10/2006 3:26:55 AM
RE: error 1929. THISFORM can onl be used within a method Posted by Ken Murphy @ 11/10/2006 4:15:54 AM
RE: error 1929. THISFORM can onl be used within a method Posted by Adam Nurrohman @ 11/11/2006 10:00:20 AM
RE: error 1929. THISFORM can onl be used within a method Posted by Ken Murphy @ 11/11/2006 3:57:07 PM
RE: error 1929. THISFORM can onl be used within a method Posted by Adam Nurrohman @ 11/16/2006 10:24:09 AM
RE: error 1929. THISFORM can onl be used within a method Posted by tushar @ 11/16/2006 10:29:39 AM
RE: error 1929. THISFORM can onl be used within a method Posted by Ken Murphy @ 11/16/2006 6:18:54 PM
RE: error 1929. THISFORM can onl be used within a method Posted by foxwizard @ 11/10/2006 4:27:52 AM