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
51
votes
6 answers

Why does C# execute Math.Sqrt() more slowly than VB.NET?

Background While running benchmark tests this morning, my colleagues and I discovered some strange things concerning performance of C# code vs. VB.NET code. We started out comparing C# vs. Delphi Prism calculating prime numbers, and found that Prism…
Matt Winckler
  • 2,223
  • 2
  • 23
  • 27
50
votes
2 answers

Add empty value to a DropDownList in ASP.net MVC

I'm building a data entry interface and have successfully bound the columns that have reference tables for their data using DropDownList so the user selects from the pre-configured values. My problem now is that I don't want the first value to be…
jvanderh
  • 2,925
  • 4
  • 24
  • 28
50
votes
2 answers

Binding property to control in Winforms

What is the best way to bind a property to a control so that when the property value is changed, the control's bound property changes with it. So if I have a property FirstName which I want to bind to a textbox's txtFirstName text value. So if I…
cubski
  • 3,218
  • 1
  • 31
  • 33
50
votes
3 answers

Should I always use the AndAlso and OrElse operators?

Is there ever a circumstance in which I would not want to use the AndAlso operator rather than the And operator? …or in which I would not want to use the OrElse operator rather than the Or operator?
Zack Peterson
  • 56,055
  • 78
  • 209
  • 280
50
votes
3 answers

TextInfo.ToTitleCase does not work as expected for ALL CAPS strings

I was trying to use TextInfo.ToTitleCase to convert some names to proper case. it works fine for strings in lowercase and mixed case but for strings with all characters in upper case, it returns the input string as is. Nothing about this behavior is…
Nimesh Madhavan
  • 6,290
  • 6
  • 44
  • 55
50
votes
10 answers

MessageBox with YesNoCancel - No & Cancel triggers same event

I have a message box with the YesNoCancel buttons... Pressing Yes will do some action and close the application - works fine Pressing No will do nothing and close the application - (see below) Pressing Cancel will do nothing and keep the…
Bibhas Debnath
  • 14,559
  • 17
  • 68
  • 96
50
votes
14 answers

How do I determine a mapped drive's actual path?

How do I determine a mapped drive's actual path? So if I have a mapped drive on a machine called "Z", how can I use .NET to determine the machine and path for the mapped folder? The code can assume it's running on the machine with the mapped…
user117499
50
votes
1 answer

Serializable Inheritance

If something inherits from a Serializable class, is the child class still Serializable?
Joe Morgan
  • 1,761
  • 6
  • 20
  • 29
50
votes
8 answers

'instance failure' error while connection string is correct

I have following code on page load event: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load con = New SqlConnection("Data Source=14GRAFICALI\\SQLEXPRESS;Initial Catalog=sagar;Integrated…
C Sharper
  • 8,284
  • 26
  • 88
  • 151
49
votes
7 answers

HTTP GET in VB.NET

What is the best way to issue a http get in VB.net? I want to get the result of a request like http://api.hostip.info/?ip=68.180.206.184
notandy
  • 3,330
  • 1
  • 27
  • 35
49
votes
10 answers

How to count the number of rows in excel with data?

column A has data like this (ie frequent blank cells): HEADING <-- this is A1 kfdsl fdjgnm fdkj gdfkj 4353 fdjk <-- this is A9 I would like to be able to get the cell reference of the last cell that has data. So in the above example, I want to…
pjj
  • 499
  • 1
  • 5
  • 4
49
votes
7 answers

FlowLayoutPanel - Automatic Width for controls?

is it possible to make the inserted items in FlowLayoutPanel automatic size of the FlowLayoutPanel? Here is an example: A form with 1 FlowLayoutPanel and 3 buttons inside: if I resize the form, the controls look like this: they arrange "left to…
MilMike
  • 12,571
  • 15
  • 65
  • 82
49
votes
3 answers

Declaring and initializing a string array in VB.NET

I was trying to return an array of strings from a function and got surprised by an error. I would have expected this to work, but it produces an error: Public Function TestError() As String() Return {"foo", "bar"} End Function This…
chris
  • 36,094
  • 53
  • 157
  • 237
49
votes
10 answers

Remove carriage return from string

I would like to insert the following into a string

some text here

some text here

some text here

I want it to go into a string as follows

some text here

some text here

some text here

i.e. without the carriage…
oshirowanen
  • 15,297
  • 82
  • 198
  • 350
49
votes
3 answers

How do I detect non-printable characters in .NET?

I'm just wondering if there is a method in .NET 2.0 that checks whether a character is printable or not – something like isprint(int) from standard C. I found Char.IsControl(Char). Could that be used for this purpose?
Baldewin
  • 1,613
  • 2
  • 16
  • 23