Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/index.php)
-   .NET General (http://www.xtremevbtalk.com/forumdisplay.php?f=98)
-   -   /!\ IMPORTANT HINTS /!\ VB6 programmers moving to .NET (http://www.xtremevbtalk.com/showthread.php?t=218136)

AtmaWeapon 04-01-2005 08:37 AM

/!\ IMPORTANT HINTS /!\ VB6 programmers moving to .NET
 
Lately I've noticed a sharp increase in the VB6 -> .NET threads, most likely due to the fact that MS is making good on the promise they made years ago to start moving away from VB6.

Now, I have a few suggestions for those moving from VB6 to .NET. I followed these hints moving from C++ to VB .NET, and lately I'm using the same methods to get a more intimate understanding of C++. These are guidelines and not rules, but I think we can make our forum a little better if we follow these guidelines.

I base all of these methods on the fact that your programming skill should be independent of any language, and I see many people who seem to be chained forever to VB6 and cannot describe a process without using VB6 code.

1. Buy a VB .NET book
VB .NET is different than VB6 in many ways, and though many VB6 functions will work in .NET a lot of them are deprecated and should be avoided. You most likely spent good money on several VB6 books and should develop the habit of continuously buying books about your current development language. If you are totally lost and have money to spend, I suggest two VB .NET books: the one by Francesco Balena and the one by Charles Petzold. These two books read together give you a general knowledge of .NET with VB and an intimate knowledge of Windows Forms. If you are lost and want to save money, just pick up Balena's book alone, there are several Windows Forms gurus at this forum that can help you, but Balena's will help you lots with getting used to .NET. More confident programmers can save money by picking up the book "VB .NET Step by Step"; it is a fast-paced whirlwind tour of VB .NET and can get you used to it in a hurry at a quarter of the cost of the other two books.

2. Play with Intellisense
Probably half of my neat little tricks come from functions I discovered by accident through Intellisense. First, you need to make sure that advanced members are displayed. In Visual Studio, click Tools>Options, and in the dialog that is displayed navigate to "Text Editor>All Languages>General". Make sure that the "Hide advanced members" checkbox is NOT checked.

Now, when you are working with VB .NET and you can't figure out how to make a control or a class do something, BEFORE you post a question, type a dot after the name and wait for Intellisense to pop up with its list of functions. For example, if you can't figure out how to get the selected item in a ListBox named ListBox1, type:
Code:

ListBox1.
and pause until the Intellisense popup is displayed. Now, this popup lists every available property and method of ListBox1. Scroll through the functions and see if one sounds like it would work. If something looks right, hover your mouse over it and a popup will reveal a brief description of its purpose. In this case, you would find a few Selectedxxxx functions that do the job.

3. Use Google to search MSDN
If you are still stumped, figure out what class name you are working with (in this case ListBox), go to Google, and type the following:
Code:

site:msdn.microsoft.com <your class> members
In this example, one of the results would say exactly "ListBox Members". Click on this page and read the entire page. This page lists every member of the class in question with a brief description, and if you do not find help here it is time to post on the forums.

4. If your post starts with "Here is how I did it in VB6", reconsider your post
One of the worst things that can happen to a programmer is to become language-dependent. If you cannot describe an algorithm or a process without using VB6 to illustrate, you are language-dependent and so long as you do not learn to rely on general pseudocode you will be stuck in VB6 land.

Additionally, by writing out the process in VB6 you are strengthening the bond your mind has on VB6. So long as your first response to any problem is to describe how easy it is in VB6, your mind will resist learning the .NET method of acheiving your goal since it already knows the VB6 way. Try to forget about VB6 or any other language but VB .NET when you are looking for a solution. The more you immerse yourself in one language alone, the easier it is to learn it.

Now, some advanced questions would probably be greatly helped by a VB6 example. If you think your question is relatively difficult, it might be a good idea to mention something like "I have done this in VB6 and have code available; if it will help I can post it". Then, if the topic is relatively difficult someone will likely ask you to post the code and you can post it.

The general rule of thumb, though, is if you have to write VB6 code to ask your question, it would probably benefit you more to just ask the question. Anything difficult enough that you have a copy-paste example laying around is probably worthy of needing the code; anything you can whip up in less than a minute in VB6 should be left alone to help you learn .NET faster.

------------------

I think if you follow these guidelines, you will find it easier to learn .NET. If everyone follows them, we'll cut down on some of the easy questions in the forum. It seems counter-productive to reduce the number of posts, but several of the questions lately are the 10th or 15th generation rehash of a question that has been asked once a month for years. I don't really mind answering the same question multiple times, but I very much enjoy a question that I don't know the answer to offhand. The fun questions are the ones that make me say "Oh this is simple, I'll have an example ready in 10 minutes", only to finish 3 hours later thinking, "Wow, that was tougher than I thiought!"

wayneph 10-10-2006 02:11 PM

Microsoft has also added documentation with Visual Studio 2005 to help you work around the difference bewteen VB6 and VB.NET.

Help for Visual Basic 6.0 Users

It covers topics Data Access, Setup and Deployment, API, User Controls, etc...
It looks like a good first resource for those, "Here is how I did it in VB6" questions.


All times are GMT -6. The time now is 11:10 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.