Click here to Skip to main content
16,011,538 members
Home / Discussions / C#
   

C#

 
GeneralDatabase access error Pin
StephenMcAllister15-Oct-04 16:11
StephenMcAllister15-Oct-04 16:11 
GeneralRe: Database access error Pin
Carl Mercier15-Oct-04 17:14
Carl Mercier15-Oct-04 17:14 
GeneralRe: Database access error Pin
Alex Korchemniy16-Oct-04 10:13
Alex Korchemniy16-Oct-04 10:13 
QuestionC# interop with type System.__ComObject? Pin
vista2715-Oct-04 15:01
vista2715-Oct-04 15:01 
AnswerRe: C# interop with type System.__ComObject? Pin
Heath Stewart15-Oct-04 15:50
protectorHeath Stewart15-Oct-04 15:50 
GeneralPosting a File on a Form Pin
Member 138504915-Oct-04 11:27
Member 138504915-Oct-04 11:27 
GeneralRe: Posting a File on a Form Pin
Alvaro Mendez15-Oct-04 11:41
Alvaro Mendez15-Oct-04 11:41 
GeneralRe: Posting a File on a Form Pin
Member 138504915-Oct-04 15:33
Member 138504915-Oct-04 15:33 
Thank you Alvaro for your response,
I am writing a program that reads records from a file of type txt containing stuffs like item name, quantity and prices. The first step is to simply read the file and output its containt on a windows form. The second step will be to compute the total cost of each item and post it the results on the form. I guess I have figured out how to do this second part ( well, i guess). But I am stuck on the first step.
This is what I have:
I have the class, reading the txt file, called PartFile. This class contains this function that is supposed to read the file (maybe typecast everything to string) and sent it to the Form.

public void ReadFile()
{
string line;
StreamReader file = new StreamReader("MyFile.txt");
while((line = file.ReadLine()) !=null)
//Console.WriteLine(line); ///commented out because I want to write the file to a Form, not Console
file.Close();
}

While reading my C# book I read about a ToString function, how can I implemente it here to read the file as strings?
Is that how I should code this function, is there anything I should do? how should I do it? Please, help me think through this.I got a brain storm now....can't find a way to get to the next level that I feel i can pretty much do. I just need to be able to read the file and post it to a form. I kind feel like i can move forward on my own (maybe) right after.
Thank, and i hope someone will help... Thank you Alvaro




A Newbie In Tha Block
GeneralRe: Posting a File on a Form Pin
Alvaro Mendez15-Oct-04 21:27
Alvaro Mendez15-Oct-04 21:27 
General.NET Remoting Reference Pin
Wender Oliveira15-Oct-04 9:45
Wender Oliveira15-Oct-04 9:45 
GeneralRe: .NET Remoting Reference Pin
Alex Korchemniy15-Oct-04 10:10
Alex Korchemniy15-Oct-04 10:10 
GeneralRe: .NET Remoting Reference Pin
Wender Oliveira15-Oct-04 10:15
Wender Oliveira15-Oct-04 10:15 
GeneralRe: .NET Remoting Reference Pin
Alex Korchemniy15-Oct-04 10:20
Alex Korchemniy15-Oct-04 10:20 
GeneralRe: .NET Remoting Reference Pin
Wender Oliveira15-Oct-04 10:24
Wender Oliveira15-Oct-04 10:24 
GeneralRe: .NET Remoting Reference Pin
Alex Korchemniy15-Oct-04 10:29
Alex Korchemniy15-Oct-04 10:29 
GeneralChange the caret color in a textbox Pin
ee9903515-Oct-04 7:30
ee9903515-Oct-04 7:30 
GeneralRe: Change the caret color in a textbox Pin
Alex Korchemniy15-Oct-04 9:47
Alex Korchemniy15-Oct-04 9:47 
GeneralRe: Change the caret color in a textbox Pin
Carl Mercier15-Oct-04 17:13
Carl Mercier15-Oct-04 17:13 
Generalslow listview refresh Pin
DF_Bandit15-Oct-04 6:49
DF_Bandit15-Oct-04 6:49 
GeneralRe: slow listview refresh Pin
Heath Stewart15-Oct-04 7:00
protectorHeath Stewart15-Oct-04 7:00 
GeneralRe: slow listview refresh Pin
DF_Bandit15-Oct-04 7:10
DF_Bandit15-Oct-04 7:10 
GeneralRe: slow listview refresh Pin
Heath Stewart15-Oct-04 8:44
protectorHeath Stewart15-Oct-04 8:44 
GeneralRe: slow listview refresh Pin
DF_Bandit15-Oct-04 9:39
DF_Bandit15-Oct-04 9:39 
GeneralRe: slow listview refresh Pin
Heath Stewart15-Oct-04 15:42
protectorHeath Stewart15-Oct-04 15:42 
GeneralRe: slow listview refresh Pin
afinnell18-Oct-04 6:17
afinnell18-Oct-04 6:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.