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
54
votes
9 answers

Is there any way to automate windows forms testing?

I am familiar with nunit for unit testing of the business layer however I am looking now to automate the test of the win forms gui layer. I have seen watin and the watin recorder for automating tests on web application by accessing the controls…
John
  • 29,788
  • 18
  • 89
  • 130
53
votes
9 answers

Should I use Call keyword in VB/VBA?

I use the Call keyword when calling subs in VB/VBA. I know it's optional, but is it better to use it or leave it off? I've always thought it was more explicit, but maybe it's just noise. Also, I read this on another forum: Using the Call keyword…
Fred Loyant
  • 531
  • 1
  • 4
  • 3
53
votes
7 answers

Update primary key value using entity framework

I'm trying to update one value of a compound primary key from within the entity framework and I'm getting this error: "The property 'CustomerID' is part of the object's key information and cannot be modified. " Here is my code: Dim customer As…
Paul Lemke
  • 5,494
  • 3
  • 47
  • 66
52
votes
10 answers

DataTable already belongs to another DataSet

This error is occuring while adding one datatable from a dataset to another ."DataTable already belongs to another DataSet." dsformulaValues.Tables.Add(m_DataAccess.GetFormulaValues (dv.ToTable.DefaultView.ToTable(False,…
kbvishnu
  • 14,760
  • 19
  • 71
  • 101
52
votes
7 answers

Why are we not allowed to specify a constructor in an interface?

Possible Duplicate: Interface defining a constructor signature? I know that you cannot specify a constructor in an interface in .Net, but why can we not? It would be really useful for my current project to be able to specify that an 'engine' must…
Pondidum
  • 11,457
  • 8
  • 50
  • 69
52
votes
2 answers

Date instead of DateTime?

From what I can tell Date and DateTime have the same functionality. Is there a reason why I would want to use one instead of the other?
poke
  • 2,934
  • 5
  • 27
  • 37
52
votes
10 answers

Get File Icon used by Shell

In .Net (C# or VB: don't care), given a file path string, FileInfo struct, or FileSystemInfo struct for a real existing file, how can I determine the icon(s) used by the shell (explorer) for that file? I'm not currently planning to use this for…
Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
52
votes
6 answers

Accessing Office Word object model through asp.net results in "failed due to the following error: 80070005 Access is denied."

I have developed a website that allows users to upload office documents then uses the office object model to convert the document to an HTML file that it then displays in an iFrame. I have, of course, included references to Office.interop.word,…
Camenwolf
  • 798
  • 1
  • 9
  • 21
52
votes
11 answers

C#'s equivalent to VB.NET's DirectCast

Does C# have an equivalent to VB.NET's DirectCast? I am aware that it has () casts and the 'as' keyword, but those line up to CType and TryCast. To be clear, these keywords do the following; CType/() casts: If it is already the correct type, cast…
csauve
  • 5,904
  • 9
  • 40
  • 50
52
votes
10 answers

.NET Integer vs Int16?

I have a questionable coding practice. When I need to iterate through a small list of items whose count limit is under 32000, I use Int16 for my i variable type instead of Integer. I do this because I assume using the Int16 is more efficient than a…
Matias Nino
  • 4,265
  • 13
  • 46
  • 63
52
votes
2 answers

OrderBy and OrderByDescending are stable?

I am currently reading Pro LINQ c# 2008, and in page 87 the guy says OrderBy and OrderByDescending are stable. But he says exactly the opposite in page 96. It looks to me as he is referring to exactly the same functions, so I don't get it. Are they…
devoured elysium
  • 101,373
  • 131
  • 340
  • 557
51
votes
6 answers

Convert StringCollection to List

Normally, I'd choose List [or, in VB, List(Of String)] over StringCollection whenever possible: see also Best string container. However, as it seems, generics — and hence, List — are apparently not supported in VS 2008's settings…
CarstenK
  • 595
  • 1
  • 5
  • 10
51
votes
4 answers

Convert List of String to a String separated by a delimiter

Whats the best way to convert a list(of string) to a string with the values seperated by a comma (,)
spacemonkeys
  • 1,689
  • 5
  • 16
  • 29
51
votes
4 answers

how to load a file into memory stream

I have a filename pointing to a text file, including its path, as a string. Now I'd like to load this .csv file into memory stream. How should I do that? For example, I have this: Dim filename as string="C:\Users\Desktop\abc.csv"
Ram
  • 901
  • 5
  • 18
  • 27
51
votes
2 answers

How to add an optional parameters/default value parameters in VB function?

How can I create a method that has optional parameters in it in Visual Basic?
Steve Duitsman
  • 2,749
  • 5
  • 27
  • 39