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
2 answers

using datareader with dbnull values in .net4

I heard there is a field extension method in framework 4 that permits one to receive null values from a datareader, without having to go through the process of first testing if not null then ... etc. There's information about the extension method…
Yugmorf
  • 320
  • 1
  • 6
  • 20
3
votes
1 answer

Can't catch COMException (vb.net)

I use the following code to access a VSS item: Dim sItem As String = "$/MyVssProject/InexistentFile.txt" Dim oItem As SourceSafeTypeLib.VSSItem = Nothing Try oItem = m_oSourceSafe.VSSItem(sItem) Catch ex As Runtime.InteropServices.COMException …
3
votes
2 answers

Attempted to read or write protected memory. This is often an indication that other memory is corrupt

I am using the following code This error occurs : Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Attempted to read or write protected memory. This is often an indication that other memory is…
jack rasha
  • 85
  • 2
  • 2
  • 6
3
votes
2 answers

Assigning result of If operator to System.Nullable type

When using the If operator (http://msdn.microsoft.com/en-us/library/bb513985(v=VS.100).aspx) to assign a value to a System.Nullable object, if the result is Nothing (null), then 0 is assigned to the object. Example: 'Expected value is null…
DCNYAM
  • 11,966
  • 8
  • 53
  • 70
3
votes
1 answer

FileInfo.Length always show a files total size, not actual current size

I am trying to monitor the progress of a large file copy proceedure (without manually copying the bytes of data myself) using the File.Copy([FileName]) command. So what I am trying to do is get the length of the file being copied, and compare that…
buzzluck68
  • 31
  • 2
3
votes
3 answers

TabPage selection, move the Focus to the previous ActiveControl when a TabPage is reselected

I need some help to focus a particular control when a TabPage is revisited. I followed many other blogs, but I wasn't able to solve the problem myself. I created the TabPages inside a MDIForm: Public Sub Tab_Open(Of T As {Form, New})(name As…
na4su
  • 109
  • 7
3
votes
2 answers

Making Textbox in VB Inputbox Larger

How can I make the textbox in a VB Inputbox larger?
Odinulf
  • 571
  • 2
  • 7
  • 18
3
votes
6 answers

Finding path of application using VB.NET

In a VB application I am building, I need to launch Outlook. Obviously, on every computer the path to Outlook will not be the same. Thus, I need to know how to find the path of Outlook on the user's computer before I Shell("path"). How would I do…
Logan
  • 31
  • 1
  • 2
  • 6
3
votes
1 answer

How can I add a control like a DateTimePicker to my office ribbon I'm creating using visual basic?

I'm creating an Microsoft Office 2010 add-in ribbon with a bunch of controls on it. I am able to add things like buttons, TextBoxes, and Labels. :-) I am not, however, able to add the one control I need, which is a DateTimePicker. :-( Is there…
Jared
  • 2,999
  • 1
  • 28
  • 39
3
votes
2 answers

Convert string from two textboxes to hh:mm vb.NET

I am working on an application in VB.NET for a manufacturing unit that runs in shifts. At the end of every shift, the application should give an alarm indicating that the shift has ended. In the application, the user keys-in shift time in Hours &…
Prashant
  • 93
  • 9
3
votes
1 answer

How to open PDF in PDFsharp where PDF is added as a resource to the project

I'm getting an error in the path because it's retrieving System.Byte[] in it. How can I access the PDF which is added in my resources? Code: PdfDocument = PdfSharp.Pdf.IO.PdfReader.Open(My.Resources.CANEezz_Individual.ToString,…
Wes Gourh
  • 69
  • 2
  • 8
3
votes
1 answer

VB Linq sorting using dynamic expressions on dynamic objects

I have a class derived from DynamicObject. I would like to sort that using a property (as passed to a BindingList ApplyCoreSort as a TypeDescriptor). I have tried a number of examples from here and other sites, but many of them are in C# and do…
Arkitec
  • 333
  • 3
  • 17
3
votes
2 answers

Check for an empty csv file in HTTP location

I am trying to follow Determine if file is empty (SSIS) to see if the file is empty at the HTTP location. I cant download it to begin with as the process is stuck at source and wont let my package finish. All I want to do is to query to source file,…
rvphx
  • 2,324
  • 6
  • 40
  • 69
3
votes
1 answer

Assistance with VB.net query

Here is my current query: select No, (select count(no) from textvote group by no) / (select count(no) from textvote where no like '%Ginoo%') from textvote Table: textvote No Sender Ginoo 1 9307895654 Ginoo 1 9566551234 Ginoo 1…
Lughen
  • 45
  • 5
3
votes
0 answers

What exactly does DAC do? (Data - tier Applications)

So I'm trying to figure out the purpose of DAC, so I tried reading here; But I am very overwhelmed by the definition (Since technically, I'm still a newbie anyway) Could anyone explain it to me in a very simple manner? based from my understanding,…
Mr.J
  • 430
  • 2
  • 10
  • 30