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
100
votes
3 answers

How do you declare a Char literal in Visual Basic .NET?

With Option Strict On: Dim theLetterA As Char = "A" returns an error about converting the string "A" to a Char. What is the syntax to enter a Char literal?
Jason Berkan
  • 8,734
  • 7
  • 29
  • 39
100
votes
26 answers

Generating an Excel file in ASP.NET

I am about to add a section to an ASP.NET app (VB.NET codebehind) that will allow a user to get data returned to them as an Excel file, which I will generate based on database data. While there are several ways of doing this, each has its own…
Dan Coates
  • 2,002
  • 3
  • 17
  • 21
98
votes
10 answers

How to get status code from webclient?

I am using the WebClient class to post some data to a web form. I would like to get the response status code of the form submission. So far I've found out how to get the status code if there is a exception Catch wex As WebException If TypeOf…
julio
  • 1,069
  • 1
  • 7
  • 8
98
votes
19 answers

Practical example where Tuple can be used in .Net 4.0?

I have seen the Tuple introduced in .Net 4 but I am not able to imagine where it can be used. We can always make a Custom class or Struct.
Amitabh
  • 59,111
  • 42
  • 110
  • 159
98
votes
5 answers

Marking A Class Static in VB.NET

As just stated in a recent question and answer, you can't inherit from a static class. How does one enforce the rules that go along with static classes inside VB.NET? Since the framework is compatible between C# and VB it would make sense that…
MagicKat
  • 9,695
  • 6
  • 32
  • 43
97
votes
13 answers

.NET graph library around?

I am looking for Graph libraries for .net. Are there any out? ps: I mean GRAPH libraries, not graphics nor charting libraries! edit: What I mean is graphs, from graph theory: (source: sourceforge.net) I also need it to have drawing capabilities.
devoured elysium
  • 101,373
  • 131
  • 340
  • 557
96
votes
2 answers

Are nested Try/Catch blocks a bad idea?

Let's say we have a structure like so: Try ' Outer try code, that can fail with more generic conditions, ' that I know less about and might not be able to handle Try ' Inner try code, that can fail with more specific conditions, '…
Goro
  • 9,919
  • 22
  • 74
  • 108
94
votes
5 answers

Check if all items are the same in a List

I have a List(Of DateTime) items. How can I check if all the items are the same with a LINQ query? At any given time there could be 1, 2, 20, 50 or 100 items in the list.
Saif Khan
  • 18,402
  • 29
  • 102
  • 147
94
votes
4 answers

What is the purpose of Microsoft.Net.Compilers?

What is the importance of this compiler? Is it a must have or could do without? What is the purpose of having another compiler anyway, or is it just a futuristic project? A brief overview would be appreciated.
usefulBee
  • 9,250
  • 10
  • 51
  • 89
93
votes
5 answers

How to execute an SSIS package from .NET?

I have a SSIS package that eventually I would like to pass parameters too, these parameters will come from a .NET application (VB or C#) so I was curious if anyone knows of how to do this, or better yet a website with helpful hints on how to do it.…
Ken
90
votes
8 answers

Way to have String.Replace only hit "whole words"

I need a way to have this: "test, and test but not testing. But yes to test".Replace("test", "text") return this: "text, and text but not testing. But yes to text" Basically I want to replace whole words, but not partial matches. NOTE: I am…
Vaccano
  • 78,325
  • 149
  • 468
  • 850
90
votes
7 answers

Convert List(of object) to List(of string)

Is there a way to convert a List(of Object) to a List(of String) in c# or vb.net without iterating through all the items? (Behind the scenes iteration is fine – I just want concise code) Update: The best way is probably just to do a new…
Geoff Appleford
  • 18,538
  • 4
  • 62
  • 85
90
votes
2 answers

MailMessage, difference between Sender and From properties

I've been using the System.Net namespace ever since we switched from .NET Framework 1.1 to the 3.5 framework, but there’s one thing that’s been puzzling me since. What's the difference between the Sender and the From properties in the MailMessage…
Freek Buurman
  • 1,279
  • 1
  • 9
  • 15
89
votes
11 answers

One line if in VB .NET

Is it possible to do one line if statement in VB .NET? If so, how?
Raúl Roa
  • 12,061
  • 13
  • 49
  • 64
89
votes
8 answers

How do I create a comma delimited string from an ArrayList?

I'm storing an ArrayList of Ids in a processing script that I want to spit out as a comma delimited list for output to the debug log. Is there a way I can get this easily without looping through things? EDIT: Thanks to Joel for pointing out the…
Dillie-O
  • 29,277
  • 14
  • 101
  • 140