Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Which .NET Language?
Message
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Miscellaneous
Thread ID:
00588521
Message ID:
00591914
Views:
26
Max et al..

Another important point relates to objects. System.Windows.Forms is language independent. Whether you are working in VB .Net or C#, the object model remains constant. This IMO, is fantastic because for once, there is true language/object independence. I think that may have been one of the big stumbling blocks for VFP developers trying to use VB. Now, regardless of the language, you can be sure the object model will remain constant. Yes, class definitions are different, but that really only extends to classes you define. Any of the .Net framework classes will be constant.

As an illustration, lets say I have a form class called frmFoo and I want to display it modally:
C#

x = New frmFoo();
x.ShowDialog()
VB

Dim x as New frmFoo()
x.ShowDialog()
Pretty much the same. Where I have found differences is in creating custom properties on forms. For example, in VB .Net, I can create a read/write property with 1 line of code in the declarations section of the form class:
Public Class Form2
    Inherits System.Windows.Forms.Form
    Public CustomProperty As Form
End Class
It is totally optional whether a private variable is created and accessed through public property Get/Set procedures. During the complilation process, my guess is that C# code is ultimately created. In C#, it would appear you have to do all of this manually. Instead of having a declarations section, you have to use the class constructor.
public class Form2 : System.Windows.Forms.Form
{

private Form customproperty ;

public Form CustomProperty
   {
      get 
	{
	  return customproperty; 
	}
       set 
	{
	   customproperty = value; 
	}
   }
}
I suppose there are add-ins to do this for you - but I have not found them yet. IMO, if you write VB code and it ultimately gets compiled to this, you are far better off going this route and use add-ins/builders with the code.
The inherits keyword IMO, is a bit clumsy. The C# definition seems more natural and more like VFP.

For me, the biggest issue has been dealing with the case sensitivity. It still trips me up.

I am currently working on a sample C# windows app that maps the form properties in windows forms to VFP forms.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform