Link to home
Start Free TrialLog in
Avatar of MarnieHook
MarnieHook

asked on

Best Practice Windows App Development - Handwrite Code or Drop objects from Toolbox on Screen?

Hi guys,
I am trying to create dataadpaters by writing the code rather than dropping the objects on my form... (avoid generating ALL the sql statements and code behind the scenes when I only want a select statement)
How come these don't now appear in the DataSource Property drop down list in the ComboBox? It also doesn't appear with the other Adapters that I created by dropping on the form.
What's the story here? Are we supposed to use these drag and drop facilities or is it better to 'handwrite' the code as suggested by my trainer in my ADO.Net course last week.
??
I'm trying to know what the 'best practice' is for creating a Windows Application.
THanks for your advice,
Marnie.
Avatar of Clif
Clif
Flag of United States of America image

The best practise is, simply, whatever works best.  Programming is one of the few things where the ends do indeed justify the means.

It is not always better to handwrite code.  You trainer may simply want you to know how to write the code so that you have a better understanding of the logic behind it.  Sort of like teaching you to do long division even though you have a calculator on your desk.
Avatar of DJ_Back-Q
DJ_Back-Q

If you don't use the darg and drop, some of the IDE functionnality's will not work. Just like you mentioned about the drop list not showing the DataSource.

If you want these IDE functionnality's I suggest that you do drag and drop and then just clean up the code you don't want.

If you able to write yourself, then you will be able to clean the mess the drag and drop made.


Andre, MCSD
ASKER CERTIFIED SOLUTION
Avatar of ptakja
ptakja
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ptakja,
"I think the Drag/Drop functionality is great for beginners, but as one becomes more advanced, they tend to steer toward the hand coding."
Wait a few more years, you'll come back to drag and drop.  ;)
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well said Andre.  

Let me rephrase what I was trying to say.  I DO use drag/drop for building GUI interfaces.  What I don't prefer it for is the database connectivity.  I prefer to hand code that for efficiency and scope reasons.

Jeff
That does make more sens hehehe, I don't use drag and drop for database connectivity either.


Andre
For database connectivity it depends.

For quick and dirty, proof of concept, I will.  For release, though, I won't.
I totally agree.

One thing I can't use the drag n drop for is Web Forms. I guess I'm just used to using plain notepad. As the days go, I guess I may switch one day.
I agree Clif.  I do the same thing.
If you put your code in the Initialize sub for the form (Where the other dropped items are defined) you will have all the functionality for your adapters like designer. In some cases, you need to define your controls in the Resource file for your form, exactly like the designer defines it. Open the .resx file for your form and check it out.
That is a possibility, but is it worth all these problems? Certainly not for controls. In the end you will have the exact same code as if using the drag n drop.
Avatar of MarnieHook

ASKER

Thankyou everybody for your useful comments. I shall do a bit of a combination I think. I guess as a beginner, I get scared when the objects I have created don't appear in the IDE as it makes me think it must be out of scope or not a valid choice. I am sure that with more practice i will learn to walk without all the lovely assistance provided by VB.Net and trust my own knowledge of where my 'self coded' objects can be referenced from.
Back to it.... thanks!
PS. I wanted to give you all points! Next time I will assign 100 points so I can split them up more effectively!
Thanks again.
Marnie.