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
3
votes
3 answers

Error sending email in vb.net 2010

I have to following code: Try Dim mail As New MailMessage() Dim SmtpServer As New SmtpClient("smtp.gmail.com") mail.From = New MailAddress(txtid.Text) mail.[To].Add(TextBox1.Text) mail.Subject = txtsub.Text mail.Body =…
User7291
  • 1,095
  • 3
  • 29
  • 71
3
votes
3 answers

How to make a Vb.net file/program To Standalone .Exe

I have a project done in VB.NET and I want to publish it for distribution. I know that when I build solution It creates an .Exe. But that requires local resorouces. If I build for release I know it works but it still needs the .Net platform…
1478963
  • 1,198
  • 4
  • 11
  • 25
3
votes
1 answer

SQL Server stored procedure failing to correctly set context info correctly

This is driving me crazy. My .NET application calls a stored proc to retreive a stored hashed password from a database: ALTER PROCEDURE [dbo].[sGetHashedPW] -- Add the parameters for the stored procedure here @UserName varchar(32) =…
KacireeSoftware
  • 798
  • 5
  • 19
3
votes
4 answers

Dynamically looping through picture box controls in Visual Basic 2010 does not seem to follow any order

In a Visual Basic 2010 form application I have the below code snippet: For Each ctlControl In Me.Panel1.Controls If TypeName(ctlControl) = "PictureBox" Then ctlControl.image = Nothing End If Next ctlControl My problem is when it…
Dean
  • 1,226
  • 2
  • 20
  • 39
3
votes
4 answers

Check whether there is a space before and after a character to perform string splitting

I am trying to split a string based on the - character and insert the words before and after the - character into a list (result) both words with different indexes. What I am trying to achieve is to check whether there is a space before and after…
HShbib
  • 1,811
  • 3
  • 25
  • 47
3
votes
2 answers

Hide Start Menu and Start Button in VB.NET

I'm setting my console full screen but I also want to hide the task bar and the start button in VB.NET using Visual Studio 2010 Thanks
Jamie
  • 674
  • 1
  • 10
  • 30
3
votes
1 answer

How would you keep from panning past the edges of a PictureBox control nested inside a Panel while zooming?

I would like to know how I can alter my code to keep from panning past the edges of the PictureBox while it is zoomed in and when it's in normal state. If possible I would also like to know how to make it zoom at the mouse's current location it is…
Greg Willard
  • 159
  • 1
  • 1
  • 8
3
votes
3 answers

VB.NET Single data type calculation issue

I want to perform a basic calculation with fractional numbers using vb.net. Dim a As Single= 7200.5 Dim b As Single= 7150.3 Dim c As Single= a - b 'Expected result = 50.2 MsgBox(a.ToString + " - " + b.ToString + " = " + c.ToString.Trim) 'Produced…
Albert Tobing
  • 169
  • 2
  • 14
3
votes
2 answers

Sending parameters to stored procedures vb.net

Hello this my first project in vb.net working with ms visual studio 2010, i want to create a class that can send parameters to stored procedures in an transact-sql database, i know how to do it in vb 6 but i'm not sure if this the right way to do it…
Diego
  • 69
  • 1
  • 2
  • 7
3
votes
1 answer

Check if user exists in Active Directory

I am using vb.net and I want to check whether a particular user exists in Active Directory. If it does, I want to display the particular user's details. How to do it? User login credentials are passed via textbox control My code: Dim de As…
vps
  • 1,337
  • 7
  • 23
  • 41
3
votes
2 answers

Windows Service not connecting to SQL Anywhere DB

I had built an application to connect to MySQL DB and SyBase - SQL Anywhere DB using VB.NET and appropriate ODBC connections. This was working fine until we had to make this application a service which keeps running in the background irrespective of…
Aaron
  • 41
  • 1
  • 4
3
votes
1 answer

NSubstitute and mocking an object to fire an event

I'm currently using NSubstitute as my mocking framework and over I'm doing reasonably well, with one exception that is... I'm attempting to mock an interaction that calls an event from inside my mocked object, unfortunately I'm really struggling to…
SeanCocteau
  • 1,838
  • 19
  • 25
3
votes
5 answers

Publish ClickOnce installation error "Exception reading from manifest" using VB.NET

I'm using Visual Studio 2010 and VB.NET. My target environment is .NET Framework 4.0. So I'm facing this problem when I'm publishing my project by using the provided Setup.exe file. After the verifying application requirement popped up, an alert…
Samuel Adam
  • 1,327
  • 4
  • 26
  • 45
3
votes
2 answers

Having problems trying to validate my combobox

I have decided to add some validation to my combobox, what I'm trying to achieve is to make sure that the user can ONLY enter fields that are in the combobox but the problem I have now is that if the user clicks on the combobox and doesnt enter…
JackSparrow
  • 389
  • 2
  • 8
  • 18
2
votes
1 answer

Query parameterized but '[' not giving search-results. VB.NET Framework 4. Entity to ESQL

The following are company name in my database. I am trying to produce on the fly string query that are foolproof against SQL Injection. I test the safety tolerance level of parameterized query against SQL Injection because I hear rumors it is not…