>What is the difference between these two lines of code?
>
>
>Dim MyConnection As New SqlConnection()
>Dim RetVal As SqlConnection = New SqlConnection()
>
Additionnally to what Mike said, I like the second declaration as it shows the type and the value/object assigned to it.
But, sometimes, we cannot do that. What I do in this case, is to assign to Nothing. Then, in the code later down below, I can assign the value or the object to it. I always have all my declarations at the top with a pre-defined value assigned to it. This makes it more clear to read and understand its meaning.