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

How to check if application is running as administrator VB.NET

I have made an application and some of its features only work with admin rights, How can I check if application is running with admin rights or not ? And show a message box if application is not running with admin rights to run as administrator.
Ali Ahmad
  • 81
  • 2
  • 9
6
votes
3 answers

Has Object in VB 2010 received the same optimalization as dynamic in C# 4.0?

Some people have argued that the C# 4.0 feature introduced with the dynamic keyword is the same as the "everything is an Object" feature of VB. However, any call on a dynamic variable will be translated into a delegate once and from then on, the…
Abel
  • 56,041
  • 24
  • 146
  • 247
5
votes
3 answers

vb.net - how to set today as a default date for time picker?

As the properties Value of the date/time picker does not allow to enter the DateTime.Now default value, I have tried to set it in the code: Private Sub DataFrom_ValueChanged(sender As System.Object, e As System.EventArgs) Handles…
user1083597
  • 53
  • 1
  • 1
  • 3
5
votes
2 answers

Hide/Disable DataGridView Column/Row Resizing Line

Does anybody know a way of disabling the line that appears when resizing datagridview rows and columns. This line flickers a lot, so I'd rather draw my own solid line myself and disable the default one. I was hoping by drawing my own thick line…
Jarron
  • 1,049
  • 2
  • 13
  • 29
5
votes
2 answers

how to get a list size em VB .NET?

I need to display a list on a ListBox component in VB .NET. // params is a string representing a path, empty means root folder params.itemsPath = "" // resp is a response object, here it is a String[] resp = myAPI.browseTags(params) Dim listSize…
gtludwig
  • 5,411
  • 10
  • 64
  • 90
5
votes
6 answers

Can a Visual Basic (.NET / 2010) file be split up for readability?

I'm writing a program in Visual Basic 2010. It's a HMI (Human-Machine Interface) and therefore has a whole whack of buttons that just send commands to other devices. As a result, there are a huge pile of event handlers for clicking buttons that…
evilspoons
  • 405
  • 2
  • 6
  • 16
5
votes
1 answer

How can we assign local variable in sub query SQL Server

I tried to set a value to variable in sub query but it doesn't work. Here is my query: declare @val1 int declare @val2 int select @val1 = sum(column1) ,(select @val2 = (select sum(column2) from table2)) ,(@val1+@val2)Result from table 1 What I…
user3916664
  • 97
  • 1
  • 4
  • 8
5
votes
2 answers

Why Thread.Abort only works if is isBackground property set to true?

I'm developing a tiny UDP console to send some data to test some GPRS devices so I modify an example that I found in CodeProject that it uses one thread; but I get an issue when I want to exit the application, the treahd refuses to stop even if I do…
E_Blue
  • 1,021
  • 1
  • 20
  • 45
5
votes
1 answer

How to implement Enum in select case statement

I have a enum with many items which I want to implement in select case statement of VB.NET as we do in c#.net. Like In C#.net we just type switch then hit Tab key and type enum variable name and hit enter key all items of enum automaticaly…
Neeraj Kumar Gupta
  • 2,157
  • 7
  • 30
  • 58
5
votes
2 answers

Get Text From Specific Textboxes From External Application - Visual Basic .Net

I can get text from external application text box but now I want to get text from my desired text box from external application. My English is not so good that's why see Image Below. The Below Code Return The First Text Box Value Only. Imports…
Muhammad Saqib
  • 2,185
  • 3
  • 35
  • 48
5
votes
2 answers

How to Query Data From SQL Server?

I have a problem in query data from database to make report in VB.NET. I use the Business Object to do the report. And here is my example data: ___________________________________________________________________________ | | | …
Eric
  • 248
  • 2
  • 8
  • 21
5
votes
1 answer

Dynamic Linq query - how do I build the select clause?

I'm trying to do some tests with Dynamic Linq at the moment, but being new at it, I am having troubles. Currently I have one DataTable object that I have filled by an SQL query to a database. Now I want to execute dynamic linq queries on this…
Martao
  • 795
  • 2
  • 6
  • 12
4
votes
1 answer

asp.net 4.0 project the server tag is not well formed compilation error

I have upgraded projects to .net framework 4.0 (VS 2010) and I am getting lots of "The server tag is not well formed". for example, validationgroup="Check has missing closing double quot. ValidationExpression="[^\"\']" -- I had to convert that to…
user1186065
  • 1,847
  • 3
  • 17
  • 22
4
votes
8 answers

parse text file and remove commas inside double quotes

I have a text file that needs to be converted into a csv file. My plan is to: parse the file line by line search and replace commas inside double quotes with a space then delete all double quotes append the line to a new csv file Question: I need…
Internet Engineer
  • 2,514
  • 8
  • 41
  • 54
4
votes
1 answer

Tool to validate naming style in VB.NET following Hungarian notation

I'm maintaining a legacy ASP.NET website written in VB.NET. Our customers force us to use Hungarian notation for declaring variables and such: E.g: Dim sSomeString as String Dim oSomeObject as xxxClass Is there any tool like FxCop, StyleCop,…