I wish to transfer user inputted text from one Form to a second, is the StreamReader the best method? or is their a simpler way of doing it? Cose example would be very much appreciated.
Secondly would the streamReader class be inputted in the Load procedure of the SecondForm to collect the data from the FirstForm?
You can reference the controls directly in child forms. The sream reader/writer is used mainly for things external to your program. Give me some of the code you have to create your two forms and I'll help you get this figured out.
StreamReader is for use with text files, not for reading from another window. The simplest way to do what you want, might be to do it on creation of the second form.
Cheers SevenHalo, I have attached the program I'm creating. As you will see at the inputted data from the first Form is to be exported to the second Form (ReportForm), then within this RichTextBox I have to sort data.
Sorry to nit-pick, but could you remove the compiled version from the zip? I only need the source code, I can compile it on my end (just a safety precaution for me and other members).
When the user hits the "Purchase btn", i wanted all the txtboxes and listboxes inputted info to be transfered to the RichTextBox1. Within the Form2 load procedure I was then going to attempt to Format and perform calculations etc,
Where did this file come from? I don't have anything in the original app you posted that saved a file, and the example I gave you just had the two objects work together.
Did you want the code to write to the second form or create a textfile? If you're creating a text file, do some XML. I know it's the bloody remains of something that might have resembled a dead horse, but it really is a good way to go instead of text files (ecspecially since you have architecture to your data).
BUt, if you're doing this to generate the data on the second form, don't write it to a file and then read from it (if that's what you're doing).
Catch me up here, I think you might have ran off and added in a couple more ideas I don't know about. I'm trailing a little now.
Hi, yes I wanted the inputted data to be written within the RichTexBox1 when the user clicked "Purchase". Then the data is deleted from the first form. I have to ensure that the data is writen to the RichTextBox in 24digits. All that I'm required to do once the data has been written to the second form is do a few calculations. Sort text via Print and Tab etc,
If you don't need to save the information when the application closes, you don't need to write it to a text file at all. The code I gave you populates the richtext on the second form (although, it doesn't display the form unless you ask for it to be displayed).
If you need to do calculations, I would do them on the main form and then write them. Since the data's already parsed on that form, it might be easier then trying to decipher your richtext. Give me an example of the format you want the information to show on ReportForm's richtext.
So you're looking for a way to export a report, not a reusable data source?
In that case, if you're not going to use some of the preassembled reporting apps (Crystal Reports, MS SQL Reporting Services, etc.); it's going to take alot more code on your part. My only recommendation to you is check out "PadLeft" and "PadRight" members of the string type. They should be a little easier to work with than formatting. Formatting is used more for masking values to look like currency or things of that nature. For spacing, I would use the two I mentioned.