[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • Last Modified:

Disadvantage of form created objects.

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")
connection.Open()
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.
0
reefcrazed
Asked:
reefcrazed
3 Solutions
 
sk33v3Commented:
I think it is more of a thing of 6 in one half dozen in the other. Probably you should just pick what is the quickest for you to perform. Some people write code faster than they can pop into the form designer and set the properties.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Right...also when answering questions for other people, it sometimes easier to create everything in code so that you don't have to worry about what the name of the control on question askers Form is...
0
 
reefcrazedAuthor Commented:
But the form seems to generate much code that is not really needed right ? Does this slow things down greatly ?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Arthur_WoodCommented:
"But the form seems to generate much code that is not really needed right ? Does this slow things down greatly ?"  

No, the performance is not affected at all. (what's a few micro-seconds, here or there, amongst friends???  LOL)

AW
0
 
sk33v3Commented:
I believe the points should be split between Arthur_Wood, Idle_Minds and Myself. We have all contributed to answering his question.
0
 
ParanoidOneCommented:
I agree
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now