By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,609 Members | 3,812 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,609 IT Pros & Developers. It's quick & easy.

a simple help pls???

P: n/a
actually,it is a very basic and simple question but i need to ask to
whom may know.i am a newbie in c++.NET 2003 and i am so embressed to
ask the question :oops: .
now,i have a output box that have some values written in it..and i
created a "save button".but i couldnt figured out how to say to save
the string(including values) in the outputbox?i mean yes it
works.when i press the button a save file dialog opens and i give a
name.but it does not save anything!how can i say it to save the data
in the outpubox?.i will give u the code of the button;

private: System::Void button1_Click_1(System::Object * sender,
System::EventArgs * e)
{
Stream* myStream ;

SaveFileDialog* saveFileDialog1 = new SaveFileDialog();

saveFileDialog1->Filter = S"txt files (*.txt)|*.txt" ;
saveFileDialog1->FilterIndex = 2 ;
saveFileDialog1->RestoreDirectory = true ;

if(saveFileDialog1->ShowDialog() == DialogResult::OK)
{
if((myStream = saveFileDialog1->OpenFile()) != 0)
{

myStream->Close();
}
}

}
where will i say to save the string in the output box.my outbox is
like;
degree 90 24.233 16
segment 12 11 12.447
degree 85 20.123 11
segment 10 17 10.212
..
..
..
but the saved file has nothing (since i dont know how to say to write
these outputext box values?).pls help me.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Jul 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Look into the System.IO.TextWriter and System.IO.TextReader objects. They
are specialized Stream objects for text loading and writing. :)

HTH,
Lars-Erik

"den.NET" <de*****@walla-dot-com.no-spam.invalid> wrote in message
news:41**********@Usenet.com...
actually,it is a very basic and simple question but i need to ask to
whom may know.i am a newbie in c++.NET 2003 and i am so embressed to
ask the question :oops: .
now,i have a output box that have some values written in it..and i
created a "save button".but i couldnt figured out how to say to save
the string(including values) in the outputbox?i mean yes it
works.when i press the button a save file dialog opens and i give a
name.but it does not save anything!how can i say it to save the data
in the outpubox?.i will give u the code of the button;

private: System::Void button1_Click_1(System::Object * sender,
System::EventArgs * e)
{
Stream* myStream ;

SaveFileDialog* saveFileDialog1 = new SaveFileDialog();

saveFileDialog1->Filter = S"txt files (*.txt)|*.txt" ;
saveFileDialog1->FilterIndex = 2 ;
saveFileDialog1->RestoreDirectory = true ;

if(saveFileDialog1->ShowDialog() == DialogResult::OK)
{
if((myStream = saveFileDialog1->OpenFile()) != 0)
{

myStream->Close();
}
}

}
where will i say to save the string in the output box.my outbox is
like;
degree 90 24.233 16
segment 12 11 12.447
degree 85 20.123 11
segment 10 17 10.212
.
.
.
but the saved file has nothing (since i dont know how to say to write
these outputext box values?).pls help me.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Jul 21 '05 #2

P: n/a
Cam
It doesn't look that you have actually written anything out!

Try this page for some sample code:
http://msdn.microsoft.com/library/de...TextToFile.asp
if(saveFileDialog1->ShowDialog() == DialogResult::OK)
{
if((myStream = saveFileDialog1->OpenFile()) != 0)
{

myStream->Close();
}
}


Jul 21 '05 #3

P: n/a
Cam
It doesn't look like you have actually written anything to the stream ...

Have a look at this page for some sample code
http://msdn.microsoft.com/library/de...TextToFile.asp

if(saveFileDialog1->ShowDialog() == DialogResult::OK)
{
if((myStream = saveFileDialog1->OpenFile()) != 0)
{

myStream->Close();
}
}


Jul 21 '05 #4

P: n/a
Cam
Oops! :)
Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.