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
88
votes
8 answers

Why can't I check if a 'DateTime' is 'Nothing'?

In VB.NET, is there a way to set a DateTime variable to "not set"? And why is it possible to set a DateTime to Nothing, but not possible to check if it is Nothing? For example: Dim d As DateTime = Nothing Dim boolNotSet As Boolean = d Is Nothing…
Muleskinner
  • 14,150
  • 19
  • 58
  • 79
88
votes
5 answers

What are the benefits of resource(.resx) files?

What compelling reasons exist for using them?
Newbie
  • 7,031
  • 9
  • 60
  • 85
87
votes
4 answers

Why does a for loop behave differently when migrating VB.NET code to C#?

I'm in the process of migrating a project from Visual Basic to C# and I've had to change how a for loop being used is declared. In VB.NET the for loop is declared below: Dim stringValue As String = "42" For i As Integer = 1 To 10 -…
slee423
  • 1,307
  • 2
  • 20
  • 34
87
votes
2 answers

Winforms: Application.Exit vs Environment.Exit vs Form.Close

Following are the ways by which we can exit an application: Environment.Exit(0) Application.Exit() Form.Close() What is the difference between these three methods and when to use each one?
Parag Meshram
  • 8,281
  • 10
  • 52
  • 88
85
votes
7 answers

VB.NET equivalent of C# "As"

What is the equivalent in VB.NET of the C# As keyword, as in the following? var x = y as String; if (x == null) ...
JoelFan
  • 37,465
  • 35
  • 132
  • 205
85
votes
1 answer

How to write a VB.Net Lambda expression

I am working on a VB.net project now. I am new to VB.Net LINQ and would like to know the Lambda equivalent of var _new = orders.Select(x => x.items > 0); in VB.Net. Someone please suggest!
Venugopal M
  • 2,280
  • 1
  • 20
  • 30
85
votes
4 answers

When is a custom attribute's constructor run?

When is it run? Does it run for each object to which I apply it, or just once? Can it do anything, or its actions are restricted?
devoured elysium
  • 101,373
  • 131
  • 340
  • 557
84
votes
4 answers

Parse a string to an Enum value in VB.NET

How can I parse a string in VB.NET to enum value? Example I have this enum: Public Enum Gender NotDefined Male Female End Enum how can I convert a string "Male" to the Gender enum's Male value?
jerbersoft
  • 4,344
  • 9
  • 42
  • 48
84
votes
20 answers

With block equivalent in C#?

I know VB.Net and am trying to brush up on my C#. Is there a With block equivalent in C#?
Dan Appleyard
  • 7,405
  • 14
  • 49
  • 80
84
votes
4 answers

Add keys/values to Dictionary at declaration

Very easy today, I think. In C#, its: Dictionary dict = new Dictionary() { { "", "" } }; But in vb, the following doesn't work. Public dict As Dictionary(Of String, String) = New Dictionary(Of String, String)…
XstreamINsanity
  • 4,176
  • 10
  • 46
  • 59
83
votes
6 answers

Reading PDF content with itextsharp dll in VB.NET or C#

How can I read PDF content with the itextsharp with the Pdfreader class. My PDF may include Plain text or Images of the text.
user221185
  • 839
  • 1
  • 7
  • 3
82
votes
4 answers

How to implement class constructor in Visual Basic?

I just would like to know how to implement class constructor in this language.
yonan2236
  • 13,371
  • 33
  • 95
  • 141
82
votes
8 answers

VB.NET equivalent for C# 'dynamic' with Option Strict On

Is there an equivalent for the C# 4 'dynamic' keyword when using type safe VB.NET, i.e. with Option Strict On?
jeroenh
  • 26,362
  • 10
  • 73
  • 104
81
votes
25 answers

Single Form Hide on Startup

I have an application with one form in it, and on the Load method I need to hide the form. The form will display itself when it has a need to (think along the lines of a outlook 2003 style popup), but I can' figure out how to hide the form on load…
Pondidum
  • 11,457
  • 8
  • 50
  • 69
81
votes
11 answers

Validating Recaptcha 2 (No CAPTCHA reCAPTCHA) in ASP.NET's server side

The new Recaptcha 2 looks promising, but i didn't find a way to validate it in ASP.NET's server side, if(Page.IsValid) in This answer, is valid for the old Recaptcha, but not the new one, How to validate the new reCAPTCHA in server side?
Alaa Alweish
  • 8,904
  • 16
  • 57
  • 84