vb.net for dummies
March 19, 2008 10:30 AM   Subscribe

Learning VB.net in one weekend - best free & online resource?

I have a CS background and have coded in a past life, but I put coding down for the last 8 years while doing mgmt / finance. I am now in a situation where I need to do some coding in VB.net, and I need to start doing some Real Coding as of next Monday. In the longterm, the challenge will not be VB but learning the API of the product that I'll be manipulating. But I need to learn VB now

I have never worked with any iteration of VB. What is the quickest way I can get going? I just need to get familiar with VB syntax, data types, etc. I have a thorough understanding of CS concepts and SW engineering methodologies. The coding I will be doing will be pretty basic, mainly foo.bar.baz(this, that) method calls, and working with forms in Visual Studio.

All of my past coding has been in C-like languages, so if you have any tips on what the VB mindset is like, that would be great. No need to start a holy war, just warn me about potential gotchas.
posted by randomstriker to Computers & Internet (9 answers total) 2 users marked this as a favorite
 
Well if it is VB.Net you need to learn (and not VB...they are different) and you have C-like previous skills, why don't you learn C# instead. In the end, C# and VB.NET compile down to the same thing and there are only minor differences in the expressive nature of the two languages (the only exception that comes to mind at the moment is VB.Net has some facilities that make working with older Windows components a bit easier).
posted by mmascolino at 10:48 AM on March 19, 2008


Response by poster: Because we (the group I'm in) work in VB.net.
posted by randomstriker at 10:55 AM on March 19, 2008


Hrm. I was once in your position, though I had more time than a weekend to ramp up. Coming from a CS and C programing background, you should know that VB is DUMB. The syntax is very simplified, no brackets and no semicolons. Those damn semicolons had me throwing errors for weeks. Force of habit.

W3Schools is a good online free resource for a lot of web programming. They have a VBScript section and an ASP.NET section, both with examples. Here's an ASP.NET/VBScript cheat sheet. I've also found this ASP.NET FAQ useful when running into problems.

If you can find it in a nearby bookstore, I've also found the ASP.NET Developer's Cookbook to be helpful. There are free demos and source code available online for each chapter.

Best of luck!
posted by geeky at 11:17 AM on March 19, 2008


First of all, just go play with it. You have the background to just pick it up, and you don't need a book telling you what an IF statement is, or how to puzzle through a FOR loop. What you need is a good overview of the standard library.

Anybody can learn the syntax for a programming language in a weekend (well, most languages, and certainly VB). The tricky part is knowing how to break the problem down into programmable steps (you have this already), and knowing what work is already done for you (the standard library).

Focus on the standard library. Get a feel for the major packages, where common stuff like Streams are, and such. Beyond that, just look up tutorials online for the specific problem you are facing (ie. need to bind a DataTable to a grid control? look it up.). The overview of the std. library will help with the looking up as well.
posted by cschneid at 11:22 AM on March 19, 2008


Probably not too helpful an answer, but i'd Nth going to C# if you at all can. It'll help you more in the long run and really is the better way of coding .NET.

If this is for a specific job (sounds like it is) and it absolutely has to be VB.net (sounds like converting everybody would not be feasible) then I would even possibly consider studying some C# to get an idea of how .NET works before going on to study VB syntac, or using sites that have C# and VB.net examples side by side.
posted by Artw at 11:25 AM on March 19, 2008


nthing that learning the library is most important and the way that you do that is to read and write practice programs. You can learn syntax pretty quickly from charts like this that compare VB.Net to C#. Hopefully your C-like background will help you find the C# example that gets you to the VB.Net syntax.

As for the library, it is huge so focusing on the basics (I would start with the namespaces System, System.Data, System.Xml, System.Collections, System, IO and System.Net). Do lots of reading through the class names and try to mentally file away their existence so that you can find them again when you are trying to solve a particular problem. Obviously adjust this list based on your target problem domain.

After that, you can dig into Windows Forms (or just jump in and use lots of simple Windows Forms apps as your driver for testing out the .Net Framework).
posted by mmascolino at 12:09 PM on March 19, 2008


Yup, .NET is the big part. VB is the tiny part. VB itself has all the things you'd expect: looping, conditionals, data structures, arrays, exceptions, etc. The .NET libraries and the .NET way of doing things will take some time, certainly more than a weekend.
posted by plinth at 12:59 PM on March 19, 2008


Where I currently work we have gone through fashions in development languages. I have coded in VB6, Java, VB.Net. IMHO VB6 was a train wreck, Java is a language only a mother could love, and VB.Net is just right!

You may already know this but VB 2008 Express Edition is free, which is what I use at home.

As has been mentioned your hands will have to get used to typing differently, but hey I also code in COBOL at work and PHP at home, so I'm proof that you can code in more than one language and keep it all straight.

Also some of the object oriented stuff is a little different. For instance, once you understand what DirectCast means you'll be moving out of newb stage.

And of course things like mySQL database access, dynamic visual control creation, encryption methods, etc. are more about your understanding of the .Net framework than the language (as has been pointed out by others).

Remember, Intellisense is your friend. Type an object and a period and wait for the VB IDE to suggest the possibilities. After you pick a method type a parentheses and it will show you the overloads and a little help on the method too. You can use the up/down arrow keys to browse the overloads. This is cool.

Here's some random lines from a project I'm writing at home to show a contact page of files in a folder, just to give you the flavor of VB.Net (MeMail me if you want to talk, but on your tight schedule you may not have time). Also, the indenting didn't survive pasting in, but if you paste into VB 2008 it will auto indent the statements.

Private Class OverviewObject
Public numImages, numRows, numCols, numGroups, picsPerGroup As Integer
Public firstImage, currIndex, currPage As Integer
Public thumbs As ArrayList, footer1, footer2 As Label, butLeft, butRight, butSel As Button
Public thumbWidth, thumbXMargin, thumbFullWidth As Integer
Public thumbHeight, thumbYMargin1, thumbYMargin2, thumbFullHeight As Integer
Public BottomMargin, TopMargin, LeftMargin As Integer
Public Sub SetCurrentMetrics(ByVal canvasW As Integer, ByVal canvasH As Integer)
SetDefaultMetrics()
SetMetrics(canvasW, canvasH)
Dim heightUsed As Integer = Me.thumbFullHeight * Me.numRows
Dim heightUnused As Integer = canvasH - Me.BottomMargin - heightUsed
Dim adjForNextRow As Integer = Convert.ToInt32 _
(Math.Round((Me.thumbFullHeight - heightUnused) / Me.numRows) + 1)
If adjForNextRow <> Me.thumbHeight -= adjForNextRow
SetMetrics(canvasW, canvasH)
End If
Me.TopMargin = (canvasH - Me.BottomMargin - (thumbFullHeight * numRows)) \ 2
Me.LeftMargin = (canvasW - (Me.thumbFullWidth * Me.numCols)) \ 2
End Sub
Private Sub SetMetrics(ByVal canvasW As Integer, ByVal canvasH As Integer)
Me.thumbFullWidth = Me.thumbWidth + (2 * Me.thumbXMargin)
Me.thumbFullHeight = Me.thumbHeight + Me.thumbYMargin1 + Me.thumbYMargin2
Me.numRows = (canvasH - Me.BottomMargin) \ Me.thumbFullHeight
Me.numCols = canvasW \ Me.thumbFullWidth
Me.picsPerGroup = Me.numRows * Me.numCols
End Sub
Public Function NumberSelectedThumbs(ByVal fa As ArrayList) As Integer
Dim jx As Integer = 0
For ix As Integer = 0 To fa.Count - 1
If DirectCast(fa(ix), FileObject).isSelected Then
jx += 1
End If
Next
Return jx
End Function
End Class

pnlOverview.Controls.Add(Overview.footer1)
pnlOverview.Controls.Add(Overview.footer2)
pnlOverview.Controls.Add(Overview.butLeft)
pnlOverview.Controls.Add(Overview.butRight)
pnlOverview.Controls.Add(Overview.butSel)
AddHandler Overview.butLeft.Click, AddressOf PageClickHandler
AddHandler Overview.butRight.Click, AddressOf PageClickHandler
AddHandler Overview.butSel.Click, AddressOf SelClickHandler

I hope this was of some help.
posted by forthright at 8:04 PM on March 19, 2008


Intellisense is your friend

That's kind of worth repeating, over and over, intellisense is your friend.

(after your programming exercise is over it will offer you cake)
posted by Artw at 8:48 AM on March 20, 2008


« Older Stress = Baked Goods   |   I am pretty good at putting on my game face Newer »
This thread is closed to new comments.