Calling methods and using properties

I have craeted a class which includes  overloaded methods,read -write properties, and methods. I have also created the user interface consisting of text boxs,radio button,datetime picker, and listbox. I can't figure out the proper way to call methods and properties I used in the class. One book says use a dim statement another book says to include RaiseEvent statement in the class and a public event statement in the code of the main form. I really having a hard time figuring waht to do.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonMiddle School Assistant TeacherCommented:
It's unclear exactly what you want here...

Is the goal for the user interface to update values inside the class based on changes made in the GUI?

augie0216Author Commented:
It is a class module thet simulates aircraft arriving and departing from an airport. the solution calculates charges based on the amount of time the aircraft stays at the airport, what type of aircraft it is, and any fuel that may be purchased for the aircraft. The user enters the the aircraftID, the carriername, type of aircraft (radio buttons) ,arrival time,departing time, dates and fuel used.
Mike TomlinsonMiddle School Assistant TeacherCommented:
So are you using one class where you pass in all that info and you should get back the results from a single function?

...or are you creating mulitple instances of this class where they all co-exist and should raise events simulating real-time events based on timers?

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

augie0216Author Commented:
I'm not sure how to answer your question. I'm very confused on this whole concept of creating reusable components with classes. The book I'm using isn't good at conveying what you are suppose to do.It gives you examples but then has you do things that are totally different then the excercises you are expected to do. If you can't answer the question I submitted because of vague information I provided you please accept my apology.
I take it you just mean generally calling a Sub or Function you'e defined in the class, inside the form code. If so then it's quite simple, but there are a few things you must remember classes:

Public Class Form1
  Public Sub Button1_Click(ByVal sender As Object, e as EventArgs) Handles Button1.Click

     ''' When using a method from a class, always "instantiate" the class.
     ''' This means including the "New" modifier in the Dim statement.
     ''' This stops you from getting "Object reference not set to an instance of an Object" exceptions.
     Dim clsYourClass As New clsClass

     ''' Then to call a method (which must be a Public/Friend method in the class to be used outside the class itself)...

  End Sub

Note: If you've added a "Sub New" constructor to your class, when you instatiate it, you must include any constructor arguments
that you specified in the "Sub New".

Hope this helps, if it's what you need :)

End Class
augie0216Author Commented:
When would you use the example you provided versus the raise event statement and With Events statement ?
A RaiseEvent statement is used to do just that. Using events is useful for when you're writing multi-threaded applications or you want fast and responsive code.

If all you need to do is call a method that does something to some data, but it's defined in a seperate class, you can just use the example.

 If, however, you want to use events to tell your program when to do something, for example, when the user types an invalid character in a text box, you could use RaiseEvent to raise an event called "InvalidCharInputEvent" that you've defined, then you would write a mehtod to "Handle" that event, in this case, you could show a Message Box telling the user that the input is invalid.

I think that's a bit deep though for what you need. Judging by your question, you just need to know how to use a method from a seperate class. One thing worth noting, is that if you write methods in a Module, you can access those methods from anywhere in your program without having to instantiate the module it is in. Modules are always useful if you want to have a method that can be accessed frequently without the need to instantiate it every time.

Hope this clears it up a bit :)


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.