Advertisement

01.22.2007 at 06:35AM PST, ID: 22131489
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

VB.Net program design, ie: where to put different parts of a program

Asked by beihudson in Microsoft Visual Basic.Net

Hi All,

I have a design question about VB.Net programming.  I've read two books on VB.Net programming and they all seem to share a common premise:

 All your buiness logic code is in the same file as your form code and it all starts when your form is loaded: ie: everything starts with Form.Load().  And lots of wizards get used to create everything automajically.

OK, thats great for small programs and examples but what if I wanted to do it differently?  What if I wanted my program to start at sub Main() in a file thats just for business logic?  What if I wanted to write all my own SQL command strings because I'm using DB generated autoincriment values?  (OK, I used to be a C/C++ programmer).  With that thinking, all the "large" objects for an app that talk to a database would be global vars in that file, sub Main() would initialize them all, do all the initial setup, getting data from the DB, population of controls with data, etc.

What do I want to do that? Because I have multiple forms and I want all the logic that isnt form specific to be in one place where I can see it all.

Anyway, after all that stuff gets done sub Main() would call application.Run() and then forms get loaded, mouse clicks work, and the whole program is now serviced by event handlers that call subs from the business logic file.

I've run into a problem with this approach already, albit minor:

I had to set the .SelectedIndex property of a ListBox control but darn it I couldnt set it in sub Main().  Code would compile and run but have no effect.  I finally tried setting it in form.Load() for the form that control belonged to and suddenly it just worked.  Strange.

So my question is:  Is my approach something that is known to work or am I way off base?

And:  Has anyone else seen unusual behavior like this?  One would think that you could manipulate controls any way you like from sub Main() but clearly, you cannot.  What about being able to manipulate other objects like DataSets and Currency managers?

Thanks in advance!

-John C.

  Start Free Trial
[+][-]01.22.2007 at 08:12AM PST, ID: 18366299

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual Basic.Net
Sign Up Now!
Solution Provided By: ctm5
Participating Experts: 1
Solution Grade: B
 
 
[+][-]01.23.2007 at 11:31AM PST, ID: 18378134

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42