Passing info to a custom class library.

VonEhle

Active member
Joined
Feb 20, 2006
Messages
26
Programming Experience
Beginner
I have a school assignment that requires me to create a class library. The form for this solution has a text box that you can type anything you wish in. You can then push a button and have four different labels show how many characters, words, sentences, and paragraphs the text box contains. Another button allows you to open any .txt file and give the same type of results. All calculations are to be done in the seperate class we create.

I was able to get this to work properly with the one that opens a .txt file. My problem is... I can't seem to figure out how to get the class library I created to know what's in the text box on the main form. In other words, how do I pass the information from the textbox in frmMain to the other class (named StringProcessor)? Am I explaining this clearly?
 
How do you normally do it? The .NET Framework is completely comprised of class libraries. When you create any object from the Framework your creating an instance of a class from a class library. If you want to get data into an object then you either set a property or call a method and pass a parameter. It's the same no matter what type you're talking about and where it is declared. Once you've referenced your class library in your Windows application project your form can create an instance of the types it contains and then set their properties or call their methods, exactly the same as you always do.
 
Back
Top