473,394 Members | 1,765 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

General Question about Main() and forms etc

Definitely a newcomer to C# (in fact to any programming after some years
away) and I'm finding lots of examples but they are sometimes confusing.

My concept of (say) QuickBasic was that you write a main program that calls
subroutines, thus breaking the thing up into manageable parts.

I started off assuming that in C# main() would be the program flow with
(say) several forms called in a similar way, each form doing it's part then
returning to the main() flow. Let me give an example.

Initialize stuff

Get a filename (call file input dialogue and validate)

Create Playlist (call creator or add to existing and validate)

Get more or play
(go back for filename or play)

Play (call media player)

Media ended
(go back or stop)

I hope this makes clear what I am asking. I visualized a form called from
main() for input and another for playing with the create playlist either in
the main flow or as a separate method. Playing would be a form of course and
I guess the decision to play more or stop could be in there as well.

Examples I've seen seem to put the majority of the code in the "Player"
form, even calling the "Get a filename" form from it, which leaves main()
doing virtually nothing except kicking off the player form.

The simple question is whether there's a right way and a wrong way to do
this or is it "Who cares as long as it works"? :)

also which is preferred.

Declare a public string fileName and then just have the form that gets
filename set it or is it better to do something like

string fileName getfilename ()

and have the getfilename method return it?

Sorry if these seem like stupid questions but there seem to be some
differences between what the book says and what people usually do if you see
what I mean, I take that to mean I am missing some reasoning here :)

Thanks for any suggestions, I have looked around but not found definitive
answers yet.

Charlie
Nov 17 '05 #1
2 1013
in my opinion, main function is just a kick-off of the player form,
it's the normal way.

the rule is : put the code where it's handy. it's just like put you
usually used things in your room and things used by your parents in
their room.

in your example, get a filename and create a playlist it's the function
of the player, so we put it with the player code. if you want to open
another playlist, it's handy.

as for the getfilename, Property will be good

Nov 17 '05 #2
Thanks for the comment, I guess I'll get used to it :)

The trouble is I've been out of programming for so long that I have not
really kept up with trends and I think it's one of those things that "Stick"
if you are actually using it but gets lost if you don't. That's how it seems
to work for me anyways :)

Charlie

<re*****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
in my opinion, main function is just a kick-off of the player form,
it's the normal way.

the rule is : put the code where it's handy. it's just like put you
usually used things in your room and things used by your parents in
their room.

in your example, get a filename and create a playlist it's the function
of the player, so we put it with the player code. if you want to open
another playlist, it's handy.

as for the getfilename, Property will be good

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: David | last post by:
I am running into situtations where confining all forms to just one window (instance of broswer) is becoming overly restrictive. Does ASP.NET provide ways to have multiple windows to interact with...
2
by: Eric Sabine | last post by:
I built a generic exception handler form which allows the user to get information from it, print it, email it, etc. for exceptions for which I explicitly didn't handle in code, such as missing...
10
by: sagar | last post by:
hi everyone, i m having a problem with mouse events. any help related is apreciated. i m having a form in which i m having 2 buttons. and i m moving(draging) these buttons on run time using...
0
by: premMS143 | last post by:
Hi Everyone, Wish u a Happy new year. I'm new to Flash. However know it lightly. I've 10 SWF files which was converted from powerpoint using 3rd party software. Now I want to create a Main...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.