Questions tagged [vb.net-2010]

The version of Visual Basic .NET used in Visual Studio/Visual Basic 2010. Use VB.NET and Visual Studio 2010 tags instead unless the question is specifically about language features added in VB.NET 2010.

The version of Visual Basic .NET used in Visual Studio/Visual Basic 2010. New features include:

  • Less-strict line continuation; for example, this syntax is allowed:

    Dim lines() As String = {
        "I am line number one",
        "and I am line number two."
    }
    
  • Auto-implemented properties. This:

    Public Property Hello() As String = "World"
    

    is compiled like this:

    Private _hello As String = "World"
    
    Public Property Hello() As String
        Get
            Return _hello
        End Get
        Set(ByVal value As String)
            _hello = value
        End Set
    End Property
    
  • Collection initializers using From:

    Dim l As New List(Of String) From {"Hello", "World"}
    
  • Multi-line lambdas:

    Call New Thread(Sub()
                        Console.WriteLine("Hello, world!")
                    End Sub).Start()
    
  • Support for dynamic types

  • Support for contravariance and covariance

The full list of changes can be found here.

2117 questions
40
votes
1 answer

System.MissingMethodException after adding an optional parameter

I am getting error of System.MissingMethodException after I have an optional parameter in one component and the other component which call it was not build as it call it with old number of parameters. Only component in which parameter is added was…
sandeep
  • 996
  • 2
  • 11
  • 22
39
votes
3 answers

what is the meaning of the dollar sign after a method name in vb.net

what is the meaning of the dollar sign after a method name in vb.net like this: Replace$("EG000000", "0", "")
user288916
  • 501
  • 1
  • 4
  • 4
23
votes
4 answers

visual studio vb.net go to line short key (Ctrl + G) is not working?

I use to work in C# and use Ctrl + G for go to line but it is not working in vb.net. Can you please. Edit menu > Go to even not show any short key. If I press Ctrl + G it opens immidiate window. Is there any thing I need to do in order to enable go…
user576510
  • 5,777
  • 20
  • 81
  • 144
21
votes
5 answers

How do I set a nullable DateTime to null in VB.NET?

I am trying to set up a date range filter on my UI, with checkboxes to say whether a DateTimePicker's value should be used, e.g. Dim fromDate As DateTime? = If(fromDatePicker.Checked, fromDatePicker.Value, Nothing) Yet setting fromDate to Nothing…
ProfK
  • 49,207
  • 121
  • 399
  • 775
20
votes
9 answers

Difference between ByVal and ByRef?

What is the difference? I always use ByVal, but, I don't really have a good idea of when should I and when not...
Saturn
  • 17,888
  • 49
  • 145
  • 271
16
votes
4 answers

INSERT permission was denied on the object 'employee_info', database 'payroll' schema dbo

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim myconnection As SqlConnection Dim mycommand As SqlCommand Dim ra As Integer myconnection = New…
jepoy
  • 173
  • 2
  • 2
  • 8
14
votes
8 answers

How to open a new form but closing the old one in VB

I have a welcome to my application as it loads up, but then need to have that form close and login form open when the continue button is hit. My code: Me.Close() Dim Login As New Form Login.Show() When I click the button it only closes…
BaeFell
  • 640
  • 1
  • 8
  • 28
14
votes
2 answers

How to dynamically create columns in datatable and assign values to it?

I will have to create columns in datatable during runtime and assign values to it. How can i do it in vb.net. Any sample please...
Anuya
  • 8,082
  • 49
  • 137
  • 222
13
votes
4 answers

Entity Framework 4.1 - Relationships between non-key columns

I have 2 entities that are related, but the legacy sql schema essentially has 2 key columns for the same table (not a 2-column key: see below). I need to create a relationship back to the 'faux key' column. Is there a way to do this declaratively…
Tom Halladay
  • 5,651
  • 6
  • 46
  • 65
11
votes
2 answers

How to determine if the SHIFT or CTRL key was pressed when launching the application

I need to be able to determine if the SHIFT or CTRL keys were pressed when the application is launched How can I do this for a Windows Forms Application?
slayernoah
  • 4,382
  • 11
  • 42
  • 73
11
votes
3 answers

version of .net framework launch not match .net framework bootstrapper project

When I build the release project of the vb.net 2010 I just started using, I get two warnings: the version of the .net framedwork launch condition does not match the selected .net framework bootstrapper package. Update the .net framewk launch…
smh
  • 265
  • 2
  • 5
  • 10
11
votes
3 answers

Getting VB.NET line numbers in stack trace

I have a VB.NET 2010 Winforms application where I'd like to include line numbers in the stack trace. I've read the following question and answers: how to print out line number during application run in VB.net Which mentions "you always need to…
PeterJ
  • 3,705
  • 28
  • 51
  • 71
10
votes
2 answers

Open a txt file when a button clicked in VB.NET

I have a log file in my project. This file is a text file (.txt). Is there a way to open this file when a button clicked without using the OpenFileDialog tool? Note that I'm using VB.NET 2010.
User7291
  • 1,095
  • 3
  • 29
  • 71
9
votes
3 answers

Missing records in SQL server tables

I have a database in place with a client that seems to lose data overnight. They enter records and exit the system, and then claim to not be able to find them again the next day. The ID numbers in the Primary Key Index of the affected tables do seem…
rev_dev_01
  • 500
  • 3
  • 20
9
votes
3 answers

Calculating time between two dates?

Can someone please help me to make this work? I want to calculate the time between two dates in VB.NET like this: startdate: 2011/12/30 enddate: 2011/12/31 Calculate: ? hour ? minute ? seconds
Meysam Savameri
  • 558
  • 2
  • 12
  • 30
1
2 3
99 100