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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fox Equivalent of VB6 Object Declaration & Usage

Status
Not open for further replies.

Auguy

Programmer
May 1, 2004
1,206
US
Can someone point me in the right direction? I have the following code I need to convert to VFP6. This code starts another application and fills in some data fields. I need to do the same form Fox. I am particularly concerned with the object declaration. What would be the equivalent in Fox? In the VB6 project, I had to add a reference to a library. Any recommendations or helpful hints would be appreciated. Here is the code.

'DECLARE THE OBJECT WITH EVENTS
Private WithEvents LASQform1 As las.LASQForm2
Dim file_name As String

'HERE WE INITIALIZE THE DATA, SET THE CLIENT DATA, AND
'FINALLY LAUNCH LASER APP

Private Sub LaunchButton_Click()
Set LASQform1 = Nothing

Set LASQform1 = New LASQForm2 'CLEAR THE OBJECT
ViewButton.Enabled = False

'CALL INITIALIZE FIRST TO PREPARE LASER APP FOR A NEW CLIENT
LASQform1.InitializeData 'ALWAYS CALL THIS BEFORE SETTING PROPERTIES!!

Call Set_BasicScreenValues

'CALL EXECUTE TO HAVE LASER APP SHOW ITSELF WITH NEW DATA
LASQform1.Execute

CloseButton.Enabled = True
Exit Sub

Problem: MsgBox "Error: Unable to establish a connection with Laser App. Make sure Type Library is registered."
End Sub

Private Sub Set_BasicScreenValues()
With LASQform1
.SetField "Client_id", "24624dfsh"
.SetField "ClientLastName", Text3.Text
.SetField "ClientFirstName", Text1.Text
.SetField "ClientMi", Text2.Text
End With
End Sub


Thanks,
Auguy
 
Something like that:

Code:
*DECLARE THE OBJECT WITH EVENTS
LOCAL LASQform1 As las.LASQForm2
LOCAL file_name As String
 
*HERE WE INITIALIZE THE DATA, SET THE CLIENT DATA, AND
*FINALLY LAUNCH LASER APP

LASQform1 = CREATEOBJECT([las.LASQForm2]) &&CLEAR THE OBJECT
LASQform1.InitializeData()

Set_BasicScreenValues()

*CALL EXECUTE TO HAVE LASER APP SHOW ITSELF WITH NEW DATA
LASQform1.Execute()

FUNCTION Set_BasicScreenValues()
 *** This couldbe made a Method of your form
 *** and replace [SomeText from any where] with the proper
 *** vaules of some textBoxes 
 With LASQform1
      .SetField("Client_id", "24624dfsh")
      .SetField("ClientLastName", [SomeText from any where])
      .SetField("ClientFirstName",[SomeText from any where])
      .SetField("ClientMi", [SomeText from any where])
 EndWith
RETURN
But w/o knowing anything about that object I can't be more specific.

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Thanks Borislav, I think that got me going down the correct path.

Auguy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top