Exploring VB .Net from a VFP Perspective (Part I) (by John Koziol)

This is the first in a series of posts on VB. Net observations.  It's not formal; it's just an online journal of things I found cool and weird coming from a VFP developer with 20 years of database language experience.

One of my tasks this past several weeks was to transfer product tests from a VFP application to a database in use by the rest of the Developer Division. I could have easily done this in VFP; as we Fox guys know, VFP is great for tossing data around.

However, I saw this as an excellent opportunity to get more comfortable with VS. Net and, specifically, VB .Net, which is the primary language the VS Data write tests in. I'd done some ad-hoc stuff up until now, and - of course - a lot of debugger work grabbing call stacks when VFP blew a rod.  But to do this right, I was going to have to become very familiar with .Net classes and objects and the means of data access in .Net

It has always seemed to me that to understand a new programming language, one must first embrace the paradigms of the language - everything else is just grammar and syntax. So I started to play.....

One of the strangest things (to me) to get my brain wrapped around is that all variables are objects of various classes and have to be declared before they can be used.  For example, in VFP we go:

nAmount = 17.50

 And then we're on our merry way....in VB. Net, we can do this two ways:

Dim nAmount As New Double

nAmount = 17.50

Or....

Dim nAmount As Double = 17.50

Easy, huh?  Now suppose you want to store that to a character variable (String in VB).  In VFP:

cAmount = STR(nAmount)

We use the STR function to transform nAmount into a string and store in to cAmount.  In VB we can do it two ways.  The new .Net way is:

Dim cAmount As String = nAmount.ToString

You see?  ToString is a method intrinsic to the Number Object. Kind of like when we want to refresh a Form object in VFP, we use frmMyForm.Refresh.  The other way is to use the CSTR function, which has been around the language for a while:

Dim cAmount As String = CSTR(nAmount)

 

Anyway, there's a lot more to learn and more cool things to try.

Commentaar van anderen:
ChristianLouboutin op 18-8-2010 om 3:47
Christian Louboutin Shoes, Christian Louboutin Shoes, Christian Louboutin, Wedding Shoes, Christian Louboutin The luxury Replica Watches is called a luxury because of its limited number of limited edition hand-made and a long period. Christian Louboutin Shoes, Wedding Shoes, Discount Christian Louboutin, Louboutin Shoes, Christian Louboutin Sale because it had these features before they sparked the desire of customers to purchase financial writer Wu Xiaobo said that when living in an era of fear. Discount Christian Louboutin, Louboutin, Sale Christian Louboutin, Louboutin Sale, Chanel Shoes, Alexander Wang Shoes uncertainty is also a productivity less means scarcity, scarcity means that for less than the demand, Manolo Blahnik Shoes, Louboutin Sale the face of this situation a few first blessing up the idea because of all the bizarre transient also had a weird overlay acts it. Louboutin Shoes, Christian Louboutin Discount, Louboutin, Christian Louboutin Sale, Buy Christian Louboutin It is not hard to understand Christian Louboutin Pumps in Japan to open its first flagship store when the customer line from 3.2 kilometers of the singular scene, in fact line up is in itself a behavior so customers will be happy this endless. YSL Shoes, Herve Leger Dress, Herve Leger V Neck Dress, Herve Leger Bandage Dress, Herve Leger Dress, Herve Leger V Neck Dress ome people commented that the Japanese auto exports to earn the franc by the French only by a Christian Louboutin to easily recover the cost of coming.
Geef feedback:

CAPTCHA image
Vul de bovenstaande code hieronder in
Verzend Commentaar