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 that 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 on a wide range of platforms:

Popular VB.NET questions on Stack Overflow

Resources

139808 questions
61
votes
2 answers

Controlling Volume Mixer

I want to control other application volume(firefox). i can do it with Volume Mixer What is the libraries of the Volume Mixer?
user1974519
  • 619
  • 1
  • 6
  • 3
61
votes
4 answers

In Visual Basic how do you create a block comment

Possible Duplicate: commenting VB code Does anybody know how to do a block comment in Visual Basic? Note: I did a few searches on here and neither those results nor the results for 'Questions that may already have your answer' appeared to ask…
Paul C
  • 4,687
  • 5
  • 39
  • 55
61
votes
9 answers

Using statement vs. IDisposable.Dispose()

It has been my understanding that the using statement in .NET calls an IDisposable object's Dispose() method once the code exits the block. Does the using statement do anything else? If not, it would seem that the following two code samples achieve…
oscilatingcretin
  • 10,457
  • 39
  • 119
  • 206
60
votes
6 answers

WPF: How do I set the Owner Window of a Dialog shown by a UserControl?

I've got a WPF application with these three types of things... WindowMain UserControlZack WindowModal UserControlZack1 sits on my WindowMain...
Zack Peterson
  • 56,055
  • 78
  • 209
  • 280
60
votes
5 answers

Ampersand vs plus for concatenating strings in VB.NET

In VB.NET, is there any advantage to using & to concatenate strings instead of +? For example Dim x as String = "hello" + " there" vs. Dim x as String = "hello" & " there" Yes, I know for a lot of string concatenations I'd want to use…
dcp
  • 54,410
  • 22
  • 144
  • 164
60
votes
6 answers

How to declare an array inline in VB.NET

I am looking for the VB.NET equivalent of var strings = new string[] {"abc", "def", "ghi"};
erik
  • 6,406
  • 3
  • 36
  • 36
59
votes
5 answers

How can I read a file even when getting an "in use by another process" exception?

In VB.NET or C#, I'm trying to read the contents of a text file that is in use by another program (that's the point, actually, I can't stop the program or it stops writing to the text file, and I want to periodically read out what is currently in…
Frustrated Guy
  • 669
  • 1
  • 8
  • 10
59
votes
5 answers

How can I get the current local hostname using C# or VB.NET?

I need to get the host name currently running the application. Any idea?
Beginner_Pal
  • 1,285
  • 6
  • 18
  • 23
59
votes
13 answers

Is the Microsoft.VisualBasic namespace "true .NET" code?

My dev team is getting ready to start a new project. The shop has been a "VB shop" since the days of VB3, but the prevailing opinion now is that we're a ".NET shop" and since C# was created specifically for .NET, whereas VB.NET was a retrofit, we've…
Mike C.
  • 4,917
  • 8
  • 34
  • 38
59
votes
11 answers

Is "ReferenceEquals(myObject, null)" better practice than "myObject == null"?

I have a co-worker who's a fan of writing his null checks as follows: if (!ReferenceEquals(myObject, null)) I, on the other hand, find this syntax cumbersome to read and prefer: if (myObject != null) I've found some articles and stack overflow…
mdryden
  • 965
  • 1
  • 9
  • 12
58
votes
2 answers

How do you bind a CollectionContainer to a collection in a view model?

I have a view model with a property that exposes a collection of things. I have a ComboBox whose ItemsSource property is bound to this collection. Now the user can select from the list. I want to allow the user to clear the selection, so I want to…
Frinavale
  • 3,908
  • 10
  • 44
  • 74
58
votes
6 answers

What is the VB.NET select case statement logic with case OR-ing?

I'm using an Or statement in my case expression. Even though I have a value within this range, it didn't find a match. Why not? Example Code: Select Case 2 Case 0 ' Some logic Case 1 ' Some other logic Case 2 Or 3 …
Llyle
  • 5,980
  • 6
  • 39
  • 56
58
votes
5 answers

When to use ExecuteScalar, ExecuteReader, and ExecuteNonQuery?

I am confused with the usage of ExecuteScalar ExecuteReader ExecuteNonQuery when executing SQL queries in my code. When should I use each of these methods?
sona
  • 1,552
  • 3
  • 18
  • 37
58
votes
6 answers

guid to base64, for URL

Question: is there a better way to do that? VB.Net Function GuidToBase64(ByVal guid As Guid) As String Return Convert.ToBase64String(guid.ToByteArray).Replace("/", "-").Replace("+", "_").Replace("=", "") End Function Function Base64ToGuid(ByVal…
Fredou
  • 19,848
  • 10
  • 58
  • 113
57
votes
15 answers

What exactly is "managed" code?

I've been writing C / C++ code for almost twenty years, and I know Perl, Python, PHP, and some Java as well, and I'm teaching myself JavaScript. But I've never done any .NET, VB, or C# stuff. What exactly does managed code mean? Wikipedia describes…
Graeme Perrow
  • 56,086
  • 21
  • 82
  • 121