Beginners Example

This forum is meant for examples of X# code.

ulli25
Posts: 4
Joined: Fri Jan 22, 2021 11:52 am

Beginners Example

Post by ulli25 »

Hello,
is there a video or a visual studio (2019? community) project for a novice?
Just to have an idea where and how to start.
Reading a simple table (dbf) and showing result in GRID on screen or similar.

Thank you.
User avatar
wriedmann
Posts: 3784
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Beginners Example

Post by wriedmann »

Hi Ulli,
unfortunately I don't know FoxPro, so I cannot help you directly.
Do you have looked in the YouTube channel?
https://www.youtube.com/channel/UCFqLBM ... 4xRxFGLiVA
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
ulli25
Posts: 4
Joined: Fri Jan 22, 2021 11:52 am

Beginners Example

Post by ulli25 »

Thank you Wolfgang.
Yes I have. Got the simple console app to work.
User avatar
wriedmann
Posts: 3784
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Beginners Example

Post by wriedmann »

Hi Ulli,
since nobody seems to have a sample for you, maybe I have to search one for you.
But I don't work in Visual Studio, but I prefer XIDE.
Would be a sample using a Windows Forms DataGrid enough?
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
ulli25
Posts: 4
Joined: Fri Jan 22, 2021 11:52 am

Beginners Example

Post by ulli25 »

Hi Wolfgang,
I would try my very best to learn from it and make it work on my computer.
I have already downloaded XIDE.
There is no time pressure. I just found XSharp by chance and I think it is a great idea.
So if you would do that I would very much appreciate your effort.
Thank you in advance.
User avatar
wriedmann
Posts: 3784
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Beginners Example

Post by wriedmann »

Hi Ulli,
as I wrote: I'm from the VO community, and therefore my knowledge of the VFP logic is very limited.
So it may be that my samples are not easy to understand for you.
Do you have any knowledge in Windows Forms or WPF or do you know only VFP?
(in some of my WPF projects I'm using DBF data, so the GUI choice don't depends on the database choice).
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
ulli25
Posts: 4
Joined: Fri Jan 22, 2021 11:52 am

Beginners Example

Post by ulli25 »

I did basic work with C# and visual studio. Developed some console application and worked with some YouTube
learning programs also for WinForms and WPF. The database can also be ms sql. I will be able to change a program to work with vfpoledb instead of sql server. Is that enough? If you suggest some other program or sample for learning purpose I will work on that in my spare time.
Ulli
TerryB1
Posts: 306
Joined: Wed Jan 03, 2018 11:58 am

Beginners Example

Post by TerryB1 »

Hi Ulli
You are in the right place. There is plenty of expertise in these forums to help you, and contributors willing to help.
There is, too, plenty to learn, as I’m sure you know. This means that you need to tackle the learning process in the most efficient and easiest way possible thus minimising time spent on learning stuff you do not or will not need in the future.
XSharp is a language designed to drag the past into the future, using a syntax most are already familiar with from the days of VO. (I did use VO, but have largely forgotten it, went to C# but importantly for other reasons, so can’t talk XSharp code.)
Therefore, unless you have an existing commercial product using VFP that you want to programmatically bring up to date, I would suggest you forget VFP and using your knowledge of what your original program did, concentrate on writing it directly in XSharp. That is likely to be the quicker route.
Having said that, if you are principally thinking development of Business Applications, although there is much read-across to C#, IMO you don’t really need much C# code.
Knowledge of WinForms and WFP will stand you in good stead.
If, however, your objective is a broader understanding then C# coding is a must.
The structures of .Net map very closely, almost identically, to real-world structures imposed by nature. That may be difficult to see, but it means future porting of your applications to accommodate new technologies (even though we don’t at the moment know what they will be) can be assured.
Terry
User avatar
wriedmann
Posts: 3784
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Beginners Example

Post by wriedmann »

Hi Ulli,
I remembered that sometimes in the past I had written a sample to use a DBF in a Windows Forms Grid.
Here it is:
WinformDBF.zip
(4.02 KiB) Downloaded 183 times
A few notes:
  • please import the viaef file into your XIDE project
  • the sample makes use of a VO class, the DBServer, so therefore you need the VO runtime libraries
  • please look at the ProgSettings.prg: there are the settings where your DBF files are and what the RDD is
  • RDD: maybe I have to explain it a bit: RDD stands for Replaceable Database Driver and indicates what engine should be used to open the data files. In my sample it is DBFNTX as I'm using sample data from the VO standard installation. If you have FoxPro data, you should use DBFVFP
  • it is in the DataFactory where the DBF files are read and written into a standard .NET datatable for use in the Windows Forms DataGrid
  • the datagrid is read only, i.e. the data is not written back to the DBF table
If you are interested, I can build the same for WPF.
And, if I have some time, I have to finish my DBFServer class that used the RDD directly and is maybe better suited to access DBF data for people that has no VO background.
Wolfgang
P.S. of course, feel free to ask! We are here to help you get started.
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
OhioJoe
Posts: 131
Joined: Wed Nov 22, 2017 12:51 pm
Location: United States

Beginners Example

Post by OhioJoe »

Wolfgang, do you ( or does anyone else) have a WPF example of your WinformDBF example?
The attachment shows how it looks when I run it locally and when I run it on a Remote Desktop server. High-resolution monitors don't like pixel-based Winforms and VO GUI renderings. I understand that "vector-based" WPF can fix this but I'd rather not go down that road without hearing from you fellows first.
WinformBrowseTest.PNG
WinformBrowseTest.PNG (225.36 KiB) Viewed 2004 times
Joe Curran
Ohio USA
Post Reply