|
-
Feb 24th, 2011, 01:36 PM
#1
Thread Starter
Fanatic Member
A Newb Question about Functions
I'm new to the world of ".NET" -- fresh out of VB6 I am.
Anyway, I just spent the past 20 mins trying to write a function and have it called correctly.
Apparently, I need to build the function within the PUBLIC CLASS frmMain (my main form) ?? Any effort to try and write the function out on it's own just causes issues.
I just wanted to understand why that is and hopefully grab a high level explanation from someone on how the new coding screen is setup. Let's say I'm writing a function that validates a value entered on my form. Am I correct in putting the function in the form class or should it go elsewhere?
-
Feb 24th, 2011, 01:43 PM
#2
Re: A Newb Question about Functions
all functions and subs need to be inside the class. Outside is used for other stuff such as global-scope variables. To see exactly how a function should be declared, start your project and go to an event handler such as form_load on the right combobox. It will show you where they go.
Note that this isn't different than vb6. If you were to load up the vb6 form file in a text editor, it's pretty much formatted similar but the IDE hides it.
-
Feb 24th, 2011, 02:35 PM
#3
Thread Starter
Fanatic Member
Re: A Newb Question about Functions
Ahhh....
Makes perfect sense. Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|