Can anybody tell me how to open (print)a text file to the screen. For example, to click a botton and the file will be shown in the screen. Using something like the code below.
private: System::Void ShwCrdBtn_Click (System::Object ^ sender, System::EventAr gs^ e)
{
FileInfo^ fi = gcnew FileInfo("C:\\M yFile.txt");
fi->OpenRead();
}
User Profile
Collapse
-
How can I open text file to the screen
-
unhandled exception and Forms
I use V C++ 2008. From the code below I am trying to make a program that will ask the user to enter a number into the text box. If the user click “OK”, without entering a number a dialog box will come up to show that unhandled exception has occurred….
I want to prevent the unhandled…. dialog box from coming up. I want to use a message box instead, to promt the user to enter a number and the program should go on.
... -
How can access variable from different class?
Below; I have 2 classes (forms), Namely, "PrintOneEmploy ee" and "DeleteOne" . In class "PrintOneEmploy ee";
I want to declare a variable with name of "fileName" to contain the name of the file "Main\\_1Main.t xt".
Later on, when I wanted to access the variable "fileName" in the other class, namely, "DeleteOne" . The
compiler show an error that the variable... -
Hi Banfa,
Thanks for your continual support.
I would appreciate if you could indulge me with a little of your details. -
From the code mentioned; I was thinking the printing problem is solved as soon as the printer started to print. Unfortunately, although it worked well, but I found that the printer will print without writing the empty space. For example if the file to be printed has the following line:
1 2 3
It will print it as:
123.
Can anybody tell me how to fix that?Leave a comment:
-
Thanks everybody. I solved like this:
...Code://Visual C++ Copy Code #using <System.dll> #using <System.Windows.Forms.dll> #using <System.Drawing.dll> using namespace System; using namespace System::IO; using namespace System::Drawing; using namespace System::Drawing::Printing; using namespace System::Windows::Forms; public ref class
Leave a comment:
-
I went there already and the instruction wants me to show something about brush and other things. I do not want to forget to let you know that I do not want to draw anything. The book has a program to print what you draw and I did it very well. But the problem is; I do not want to draw or even print a graphic file. All I want to do is to print a simple text file. The thing that frustrated me is I can do the hard thing by following the book,...Leave a comment:
-
Hi Banfa,
I appreciate your help.
I did the following and Ihave the following error.
FileStream^ fs = gcnew FileStream("Rea dMe.txt", FileMode::Open) ;
Graphics^ gr;
gr->DrawString() ;
error C2661: 'System::Drawin g::Graphics::Dr awString' : no overloaded function takes 0 argumentsLeave a comment:
-
How can I use print handler to pring a file?
Hi everybody,
I need your help.
The code below is good if I want to print a sketch. The book did not show how to print a simple text file. Right now if I run this program (as is)it will show the printer dialog box. If I click OK (to print), the printer will print an empty paper. How can I use this code to print a file?
I would apprciate it if you could help.
...Code:private: System::Void
Last edited by Frinavale; Oct 7 '09, 08:57 PM. Reason: Please post code in [code] ... [/code]tags. Changed <code> tags into [code] tags.
No activity results to display
Show More
Leave a comment: