Disadvantage of form created objects.
Posted on 2006-05-26
I am trying to learn "The right way" of programming in VB.NET. What I have noticed in the tutorials at Microsoft or LearnVisualStudio.com is that most of the time they drag the objects to the form from the toolbar, such as grids, dataadapters, etc.
Now when on the forums and I ask questions, the code returned from the responding party normally has things created in code such as this.
Dim connection As SqlConnection = New SqlConnection("Secret text in here")
Dim command As SqlCommand = New SqlCommand("RETURNIT", connection)
Dim adapter As SqlDataAdapter = New SqlDataAdapter(command)
Dim table As DataTable = New DataTable
I want to learn the "right way" or even the way that will make my program cleaner and faster, whatever the best practice is.