Website may be up and down over next few months. I'm currently doing a complete overhaul of everything. Going back to simple individual .htm pages, new overall site theme, sanitizing and cleaning up html of all pages and blog posts, attempting to implement a new tooling and publishing system etc etc.

I came across this kinda stupid quark about VB.NET and varible declorations after doing some code conversions from c# to vb.net.

ConvertCSharp2VB

If you try to declare 2 varibles on the same line and set there initial value like so you get the fallowing design time error...
Explicit initialization is not permitted with multiple variables declared with a single type specifier.

Dim a, b As Integer = 0

Strangly if you declare the varibles like so ...

Dim a As Integer, b As Integer = 0

... You no longer get the error?

I could understand this error if variants were still apart of vb.net. For example ...

Dim a, b As Integer = 0

... Would result in 'a' being a variant and 'b' being an integer. But there are no variants in vb.net. I'm guessing it's a feature the MS team has not discovered or have got around to implementing yet. BTW, I am using vs.net 2002 so this varible decloration quark may have been fixed in laters version of vs.net.


Add comment



biuquote
  • Comment
  • Preview
Loading






Created by: X

Just another personal website in this crazy online world

Name of author Dean Lunz (aka Created by: X)
Computer programming nerd, and tech geek.
About Me -- Resume