Visual Basic 2010 Object and List Initialization

I just found this out and I am really excited about it! The With & From are cooler than ever!

Check this out:

Module Module1
Private Class TestClass
Public Property Subject As String
Public Property Grade As String
Public Property Student As String
End Class
Sub Main()
Dim myTest As New TestClass With {.Grade = "A+", .Student = "Myself", .Subject = "Advanced Chromotography"}

Dim test As New System.Collections.Generic.List(Of TestClass) From {
myTest,
New TestClass With {.Subject = "Math", .Student = "John Bowman", .Grade = "B"}}

End Sub
End Module

The With and From are now part of the declaration statement, saving even more real estate on the screen.

Advertisement

SQL Server Reporting Services ~ Cascading/Dependant Parameters

This is my first screencast, enjoy!

Visual Basic Basics: Visual Basic 2010 – Implicit Line Continuation

VB Line Continuation Operator (_ underscore)

Yay _

no more _

under scores _

for line continuation!!!!!_

It was one of my pain points in VB. Please visit the below, he does a wonderful job explaining it.

Visual Basic 2010 : Implicit Line Continuation – Fryan’s Digital World.

And of course, we all know that Visual Basic is superior to C#:

http://www.simple-talk.com/dotnet/.net-framework/10-reasons-why-visual-basic-is-better-than-c/

Honestly I like both, but I am partial to VB, C# is a little more masochistic.

VB.Net C# Designtime Error ~ ‘.ctor’ is not a valid identifier.

Tired of searching you project for that string? The answer is simple, which was proposed by Vladmir from Serbia on MSDN. The name of your class or form shares it’s name with a function or subroutine contained within that class. Like below:

public class Form1

private sub Form1()

end sub

end class

Changing the name of the method will fix this issue.

IIS Frontpage Extensions – You are not authorized to view this page

If you get this error something changed with your environment that is forcing anonymous login to the server. Here is what to do:

Within IIS Manager, right click on the site in which you need access to. Click on the directory security tab. Click on the edit button within Authentication and Access control. Click on Integrated Windows Authentication.

Enjoy! Of course your account will actually need rights to the site in question.

Visual Studio – Data Binding: “The operation could not be completed. Access denied.”

I ran into this problem yesterday and let it go until this morning. I got this error message and had a hard time figuring it out.  Here is a link to the MSDN Forum thread discussing this: http://social.msdn.microsoft.com/forums/en-US/vblanguage/thread/94868d04-de4f-44a9-a362-4ffb1f130bae

This particular thread is specific to Visual Studio Express but is really applicable to all editions of Visual Studio 2005.

The Solution

Open your project’s properties tab.

In the Debug section uncheck “Enable the Visual Studio hosting process”.

This will allow you to find out in more detail what the problem is. In my case I forgot to code in the password in the connection string.

Afterwards, you can check the “Enable the Visual Studio hosting process” option again.