Questions tagged [vb.net]

Visual Basic.NET (VB.NET) is a multi-paradigm, managed, type-safe, object-oriented computer programming language. Along with C# and F#, it is one of the main languages targeting the .NET Framework. VB.NET can be viewed as an evolution of Microsoft's Visual Basic 6 (VB6) but implemented on the Microsoft .NET Framework. DO NOT USE this tag for VB6, VBA or VBScript questions.

Microsoft's Visual Basic .NET (VB.NET) is a multi-paradigm, managed, type-safe, object-oriented computer programming language. Along with C# and F#, it is one of the main languages targeting the .NET Framework. VB.NET can be viewed as an evolution of Microsoft's Visual Basic 6, but implemented on the Microsoft .NET Framework. This is reflected in VB.NET's version numbering, which continues from VB6. Although Microsoft decided to drop the ".NET" portion of the language's name in 2005, it is still often referred to that way in order to distinguish it from its predecessors.

This tag should only be used for questions which relate to .NET versions of VB. It should not be confused with , , or . Although those languages share a similar syntax with VB.NET, they are entirely different technologies.

To date, the following versions of VB.NET have been released:

VB.NET is supported in a wide range of platforms:

Popular VB.NET questions on Stack Overflow

Resources

134281 questions
1874
votes
28 answers

What is a NullReferenceException, and how do I fix it?

I have some code and when it executes, it throws a NullReferenceException, saying: Object reference not set to an instance of an object. What does this mean, and what can I do to fix this error?
John Saunders
  • 157,405
  • 24
  • 229
  • 388
1468
votes
19 answers

Why is Dictionary preferred over Hashtable in C#?

In most programming languages, dictionaries are preferred over hashtables. What are the reasons behind that?
Nakul Chaudhary
  • 23,766
  • 15
  • 42
  • 46
854
votes
13 answers

How to enable assembly bind failure logging (Fusion) in .NET

How do I enable assembly bind failure logging (Fusion) in .NET?
user32736
  • 9,511
  • 3
  • 16
  • 6
769
votes
17 answers

Converting string to byte array in C#

I'm converting something from VB into C#. Having a problem with the syntax of this statement: if ((searchResult.Properties["user"].Count > 0)) { profile.User = System.Text.Encoding.UTF8.GetString(searchResult.Properties["user"][0]); } I then…
nouptime
  • 8,267
  • 5
  • 18
  • 33
561
votes
12 answers

How do you get a string from a MemoryStream?

If I am given a MemoryStream that I know has been populated with a String, how do I get a String back out?
Brian
  • 35,135
  • 22
  • 88
  • 108
470
votes
4 answers

Is there a conditional ternary operator in VB.NET?

In Perl (and other languages) a conditional ternary operator can be expressed like this: my $foo = $bar == $buz ? $cat : $dog; Is there a similar operator in VB.NET?
Jim Counts
  • 11,812
  • 8
  • 40
  • 63
416
votes
21 answers

Why is there no ForEach extension method on IEnumerable?

Inspired by another question asking about the missing Zip function: Why is there no ForEach extension method on the IEnumerable interface? Or anywhere? The only class that gets a ForEach method is List<>. Is there a reason why it's missing, maybe…
Cameron MacFarland
  • 65,569
  • 20
  • 98
  • 130
414
votes
15 answers

When should I use a List vs a LinkedList

When is it better to use a List vs a LinkedList?
Jonathan Allen
  • 63,625
  • 65
  • 234
  • 426
413
votes
26 answers

What is the best workaround for the WCF client `using` block issue?

I like instantiating my WCF service clients within a using block as it's pretty much the standard way to use resources that implement IDisposable: using (var client = new SomeWCFServiceClient()) { //Do something with the client } But, as…
Eric King
  • 10,848
  • 5
  • 39
  • 49
359
votes
41 answers

Difference in months between two dates

How to calculate the difference in months between two dates in C#? Is there is equivalent of VB's DateDiff() method in C#. I need to find difference in months between two dates that are years apart. The documentation says that I can use TimeSpan…
Rauf
  • 10,916
  • 19
  • 67
  • 115
342
votes
3 answers

Visual Studio jump to next error shortcut?

When a compile fails in VB.NET in Visual Studio 2008, an Error List pops up at the bottom of the screen. To jump to an error, I double click on an error in the error list. Is there a shortcut to automatically jump to the next error in the list? It…
Brian Webster
  • 27,545
  • 47
  • 143
  • 218
325
votes
7 answers

What is the purpose of a stack? Why do we need it?

So I am learning MSIL right now to learn to debug my C# .NET applications. I've always wondered: what is the purpose of the stack? Just to put my question in context: Why is there a transfer from memory to stack or "loading?" On the other hand,…
Jan Carlo Viray
  • 11,088
  • 11
  • 40
  • 59
298
votes
21 answers

How do I get a human-readable file size in bytes abbreviation using .NET?

How do I get a human-readable file size in bytes abbreviation using .NET? Example: Take input 7,326,629 and display 6.98 MB
Larsenal
  • 45,294
  • 40
  • 140
  • 210
295
votes
9 answers

How do I get my C# program to sleep for 50 msec?

How do I get my C# program to sleep for 50 milliseconds? This might seem an easy question, but I'm having a temporary brain failure moment!
TK.
  • 42,559
  • 46
  • 114
  • 145
264
votes
11 answers

What is the difference between And and AndAlso in VB.NET?

In VB.NET, what is the difference between And and AndAlso? Which should I use?
Nakul Chaudhary
  • 23,766
  • 15
  • 42
  • 46
1
2 3
99 100