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
57
votes
2 answers

Differences Between vbLf, vbCrLf & vbCr Constants

I used constants like vbLf , vbCrLf & vbCr in a MsgBox; it produces same output in a MsgBox (Text "Hai" appears in a first paragraph and a word "Welcome" appears in a next Paragraph ) MsgBox("Hai" & vbLf & "Welcome") MsgBox ("Hai" & vbCrLf &…
Lawrance
  • 975
  • 3
  • 9
  • 17
57
votes
5 answers

unable to evaluate expression whilst debugging

When debugging asp.net code (running against IIS, and using Visual studio 2013) and in a breakpoint and trying to evaluate a variable using quick watch i quite often get "unable to evaluate expression". deleting the .suo from the asp.net project…
Tim
  • 7,401
  • 13
  • 61
  • 102
56
votes
5 answers

How does the "Using" statement translate from C# to VB?

For example: BitmapImage bitmap = new BitmapImage(); byte[] buffer = GetHugeByteArray(); // from some external source using (MemoryStream stream = new MemoryStream(buffer, false)) { bitmap.BeginInit(); bitmap.CacheOption =…
Daniel
  • 10,864
  • 22
  • 84
  • 115
56
votes
11 answers

VB.NET Empty String Array

How can I create an empty one-dimensional string array?
YonahW
  • 15,790
  • 8
  • 42
  • 46
56
votes
2 answers

How can I add user-supplied input to an SQL statement?

I am trying to create an SQL statement using user-supplied data. I use code similar to this in C#: var sql = "INSERT INTO myTable (myField1, myField2) " + "VALUES ('" + someVariable + "', '" + someTextBox.Text + "');"; var cmd = new…
Heinzi
  • 167,459
  • 57
  • 363
  • 519
56
votes
18 answers

Could not find type 'xxx.xxx.xxx'. Please make sure that the assembly

I've searched StackOverflow and found similar problems when I try and open a form that references a UserControl in a different project. I get the To prevent possible data loss before loading the designer, the following errors must be…
56
votes
8 answers

How to disable region collapsing or expand ALL regions in Visual Studio VB.NET?

In Visual Studio C# (2008), Ctrl+M+L expand all the regions. There's also a setting in menu: Tools -> Options -> Text Editor -> C# -> Advanced to not collapse during file open. I see no equivalents in VB.NET. Is there a way to expand all the…
Tony_Henrich
  • 42,411
  • 75
  • 239
  • 374
55
votes
9 answers

Detecting remote desktop connection

Is there anyway, in a program, to detect if a program is being run from inside a remote desktop session or if the program is being run normal in .NET 2.0? What I'm trying to do is, I create a timeclock application which will clock a person in and…
Alan
  • 649
  • 2
  • 8
  • 9
55
votes
6 answers

How to append one DataTable to another DataTable

I would like to append one DataTable to another DataTable. I see the DataTable class has two methods; "Load(IDataReader)" and "Merge(DataTable)". From the documentation, both appear to 'merge' the incoming data with the existing DataTable if rows…
410
  • 3,170
  • 8
  • 32
  • 36
55
votes
3 answers

What do Option Strict and Option Explicit do?

I saw this post: Typos… Just use option strict and explicit please.. during one software development project, which I was on as a consultant, they were getting ridiculous amounts of errors everywhere… turned out the developer couldn’t spell and…
yretuta
  • 7,963
  • 17
  • 80
  • 151
55
votes
3 answers

Why is it bad to use an iteration variable in a lambda expression

I was just writing some quick code and noticed this complier error Using the iteration variable in a lambda expression may have unexpected results. Instead, create a local variable within the loop and assign it the value of the iteration…
Nathan W
  • 54,475
  • 27
  • 99
  • 146
55
votes
1 answer

How to raise an exception in VB.NET

How should an exception be raised in VB.NET?
CJ7
  • 22,579
  • 65
  • 193
  • 321
54
votes
7 answers

Compare compiled .NET assemblies?

Are there any good programs out there to compare to compile .NET assemblies? For example I have HelloWorld.dll (1.0.0.0) and HelloWorld.dll (2.0.0.0), and I want to compare differences how can I do this? I know I can use .NET Reflector and use the…
Danny G
  • 3,660
  • 4
  • 38
  • 50
54
votes
5 answers

Is there a built-in function to repeat a string or char in .NET?

Is there a function in C# that returns x times of a given char or string? Or must I code it myself?
HasanG
  • 12,734
  • 29
  • 100
  • 154
54
votes
4 answers

Visual Basic equivalent of C# type check

What is the Visual Basic equivalent of the following C# boolean expression? data.GetType() == typeof(System.Data.DataView) Note: The variable data is declared as IEnumerable.
Steven
  • 13,501
  • 27
  • 102
  • 146