Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Requery ?
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01474625
Message ID:
01474648
Views:
39
You need to use NewObject or AddObject, not CreateObject.

NewObject method is used to add new form's controls to the form.

CreateObject is used when you need to create a reference to some object. With visual objects (with the exception of forms) in 99% of cases you use NewObject.

>I guess I don't know how to do this as well as I thought I did. Here's what I have. I am getting weird errors. I thought I created the object for the grid. I called it "oGrid" and yet when I reference it, I get errors saying it doesn't exist. Yet, when I look at the debugger, the oGrid is there.
>
>
>SET NEAR ON
>SET CLASSLIB TO "cmw_classes.vcx"
>WITH ThisForm
>	DO CASE
>		CASE .cboOrder.ListIndex = 2	&& Part Number (CustPartNo)
>			*.grdFindQuote.RecordSource = ""
>			* Get rid of the current grid and instatiate the grid class
>			* ghrdSearchQuotes.
>			SET STEP ON
>			ThisForm.grdfindQuote.RemoveObject("grdFindQuote")
>			
>			SELECT ;
>					RECNO() AS Rec_No, ;
>					QuoteID, ;
>					CustPartNo, ;
>					Proj_Name, ;
>					Cust_Name, ;
>					dQuote, ;
>					Material1 ;
>				FROM Quotes ;
>				WHERE UPPER(Quotes.CustPartNo) = ALLTRIM(UPPER(.txtSearchBy.Value)) ;
>				INTO TABLE C:\Dev\CMW\Data\tmpQuotes
>			
>			oGrid = CREATEOBJECT("grdSearchQuotes")
>			
>			SELECT tmpQuotes
>			LOCATE
>			.oGrid.RecordSource = "tmpQuotes"
>			.oGrid.Refresh()
>			.oGrid.SetFocus()
>	ENDCASE
>	*.grdFindQuote.Refresh()
>ENDWITH
>
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform