C# Developer - VB Questions

charon

New member
Joined
Jan 3, 2008
Messages
1
Programming Experience
10+
I did try to search for posts containing "c#", but unfortuately the search tool will not allow a 2 character search term. If I am asking questions that have already been asked, please forgive me.

I have been using C# since RC2, but now I need to start using VB for a new job. Here are some of my frustrations so far, I am hoping that there are just different ways of doing these things in VB that I am not aware of. Any help would be appreciated.

1) Creating Properties: I created a boolean property called "Running" with a private member named "_running". In C# this took me 27 key strokes and in VB it took 85. Most of that is due to the fact that I have to manually create the "get" and "set" and the fact that when I type "return " intellisense only offers me "true" and "false" but not "_running", the same with the "set". Is there a faster way of creating properties?

2) Namespaces: Is there a way to have VB automatically add the namespace? If not, is there an easier way to add the namespace declaration than having to add it to both Partial classes?

3) Access Modifiers: Is there a way to enable auto completion for the access modifiers, or do I have to type out "public", "private", etc everytime?

4) Auto-Completion: Is there a way to enable auto intellisense for parameters and such? I.E. I have a sub with a parameter named "myParam". Do I have to type "m" and then hit the <alt> <right-arrow> to get the intellisense to pop up or can I somehow enable automatic intellisense.


It seems to take approximately 4 times the keystrokes to perform a task in VB as in C#. Is there a better way to configure VB to lessen the amount of keystrokes it takes to perform these tasks, or does anyone know of a good tool I can buy? I consider myself a fairly fast coder and I'm really afraid that this is going to slow me down; especially since I'm not a touch-typist and can only type about 45 wpm (which is pretty good for a hunt-n-pecker).
 
1.) When you type in something like "Friend Property Running As Boolean" then press the enter key, it fills in the rest of the Get/Set structure for you, all you have to do is fill in the Return statement for the Get and of course assign the Value variable to your variable in the Set statement, it's not very many keystrokes

2.) I'm not sure, I don't give adding a namespace much thought. When I establish a namespace on one side, I copy and paste it over in the other file (for partial classes)

3.) I wouldn't worry about having to type in a word like "private", "Friend", etc...

4.) When you type in the name of a class and press the period key, intellisense pops up automatically. As far as I know, when passing a variable as a parameter, you have to type in the whole variable name

VB does require more keystrokes and knowing when the IDE will kick in and complete some of the code for you will help you save time. I can see you're a C# power user, which also means that I wouldn't be surprised if VB gets on your nerves.
 
1. In C# you probably would used the "prop" code snippet, i.e. typed "prop" and hit Tab twice. VB supports code snippets too but they are not listed by Intellisense as they are in C#. In VB you can type "property" and hit Enter and the IDE will create the equivalent skeleton as in C#, with the same help to move to the relevant parts of the code.

2. Your classes are already in the project's default namespace. In C# the project's default namespace was added automatically to all your forms. In VB it doesn't need to be added. You only need a Namespace block if you want the class to be a member of a subnamespace of the default.

3. Again, VB Intellisense doesn't list access modifiers and similar key words like C# does.

4. I think Intellisense in VB 2008 is a bit more like C# but in VB 2005 Intellisense usually doesn't appear until the first dot is typed. You can press Ctrl+Space to invoke Intellisense at any time.

Four times the key strokes is definitely an exaggeration, but VB is a more verbose language so some things will take more typing. There are some things that are less effort in VB too though. If you want to reduce your typing then I suggest you get the Code Snippet Editor and create some code snippets of your own. You may be able to make VB require less typing than C# even. I'm not sure whether the CSE supports C# as well or not.
 
Back
Top