xsharp.eu • Ultra stupid question
Page 1 of 2

Ultra stupid question

Posted: Wed Apr 10, 2019 12:44 pm
by Anonymous
In VS 2017, how does one call another "form.prg" ??

Ultra stupid question

Posted: Wed Apr 10, 2019 12:53 pm
by Chris
What do you mean, how to display another form? If you have created another, say Form2, then you need

LOCAL oForm AS Form2
oForm := Form2{}
oForm:Show()

If you are just asking how to create another form, then you need to use Project->Add New Item and from the list pick "Windows.Forms.Form".

If you are asking something different, please explain!

Ultra stupid question

Posted: Wed Apr 10, 2019 1:18 pm
by fxsharp
I want to run/call the form program. In VFP you execute: do form1.prg or do form form1. I don't have any Clipper/VO experience.

The form was created via -> right click on project -> Add -> New Item -> Windows Forms/Windows Forms Forms

Ultra stupid question

Posted: Wed Apr 10, 2019 1:24 pm
by lumberjack
Hi,
fxsharp wrote:I want to run/call the form program. In VFP you execute: do form1.prg or do form form1. I don't have any Clipper/VO experience.
The form was created via -> right click on project -> Add -> New Item -> Windows Forms/Windows Forms Forms
Here is the basics of an application that creates a MainForm via the designer and run it:

Code: Select all

USING System.Windows.Forms
USING System.Drawing

[STAThreadAttribute];
FUNCTION Start( asCmdLine AS STRING[] ) AS INT
	LOCAL nExitCode AS INT
	nExitCode := 0
	Application.EnableVisualStyles()
	Application.Run(FormMain{})
RETURN nExitCode

Ultra stupid question

Posted: Wed Apr 10, 2019 2:15 pm
by fxsharp
I used the following and it worked:

LOCAL oForm AS Form2
oForm := Form2{}
oForm:Show()

Thanks

Ultra stupid question

Posted: Wed Apr 10, 2019 3:35 pm
by FFF
fxsharp wrote:I used the following and it worked:

LOCAL oForm AS Form2
oForm := Form2{}
oForm:Show()
You see, why we loved VO?
LOCAL oForm AS Form2 // you have a cookie cutter, defined somewhere in your app
oForm := Form2{} // you make "a" cookie
oForm:Show() // you say: show yourself, that i might eat you ;)

Easier and clearer, imho, it can't get.

Karl

Ultra stupid question

Posted: Wed Apr 10, 2019 7:40 pm
by fxsharp
VFP also has class based forms. Thought there might be an old school way of launching programs. And I don't know squat about .NET, to make matters worse.

Ultra stupid question

Posted: Thu Apr 11, 2019 9:43 am
by lumberjack
fxsharp wrote:VFP also has class based forms. Thought there might be an old school way of launching programs. And I don't know squat about .NET, to make matters worse.
Don't worry about not knowing .NET

Just ask and we will assist. Even better, just post a VFP example and we will show you how to achieve the same effect in X#. It will get easier as more of the VFP syntax is supported in X#.

XBase greets,

Ultra stupid question

Posted: Sun Apr 14, 2019 4:16 am
by fxsharp
Thanks lumberjack. I did not use VFP much to be honest. Mostly FPD. I spent a lot of time understanding OOP in VFP and wrote a few small apps but never made the leap because I thought in the back of my head Microsoft was going to abandon the product. Sure enough they did. In between I'd mess around with clipper and then harbour, but never saw a future in it. If xSharp gains traction, then I'll be sold. I'm actually not really interested in xSharp/VFP.

Ultra stupid question

Posted: Sun Apr 14, 2019 5:00 am
by lumberjack
Well I am interested in seeing what we can do with your code in XSharp...