Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 27th, 2008, 6:15 AM   #1
BstrucT
Hobbyist Programmer
 
BstrucT's Avatar
 
Join Date: Dec 2007
Location: Durban, South-Africa
Posts: 207
Rep Power: 1 BstrucT is on a distinguished road
C# Streams and Installer Question

Hi All

I knew there was a similar post about this subject a while back, but I would like to know if anyone can help me with this...

I have written a program in MS Visual C# 2005 Express.
The application basically capture user information typed in, (provision made for exception handling), then updates the files with streams(which saves the file with ".FILE" extension in default directory.
It can also save as a text file, but anyway...

How can I go about changing the location where the .FILE files gets saved to?

Here is my source code of the relevant piece.

 private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                StreamWriter stmWrite = new StreamWriter(rtbSaveName.Text);

                stmWrite.WriteLine(DatePicker.Text);
                stmWrite.WriteLine(TimePicker.Text);
                stmWrite.WriteLine(lbxClients.Text);
                stmWrite.WriteLine(lbxHauliers.Text);
                stmWrite.WriteLine(txtVessel.Text);
                stmWrite.WriteLine(rtbContainerID.Text);
                stmWrite.WriteLine(Cont_Det.ToString());

                stmWrite.Close();

                DatePicker.Text = "";
                TimePicker.Text = "";
                lbxClients.Text = "";
                lbxHauliers.Text = "";
                txtVessel.Text = "";
                rtbContainerID.Text = "";
                Cont_Det.ToString();
            }
            catch
            {
                MessageBox.Show("Stream Error");
            }
        }

Where
rtbSaveName.Text
is just a text box where I specify the name of the file to be saved.

I would also just like to know if anyone knows ao any links to help me set up an installer for my application as I just know of MS Visual C#'s Publish function.

All help will be, as allways, much appreciated.
__________________
"Common sense is the collection of prejudices acquired by age eighteen." - Albert Einstein
BstrucT is offline   Reply With Quote
Old Mar 27th, 2008, 8:58 AM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Re: C# Streams and Installer Question

Specify a path:
StreamWriter stmWrite = new StreamWriter(@"C:\Path\To\Directory\" + rtbSaveName.Text);
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Mar 27th, 2008, 9:40 AM   #3
BstrucT
Hobbyist Programmer
 
BstrucT's Avatar
 
Join Date: Dec 2007
Location: Durban, South-Africa
Posts: 207
Rep Power: 1 BstrucT is on a distinguished road
Re: C# Streams and Installer Question

Excellent stuff!

Thanks man, just couldn't figure it out you know.
Much Appreciated, finally I can add some level of controll to the app.

>BstrucT<
__________________
"Common sense is the collection of prejudices acquired by age eighteen." - Albert Einstein
BstrucT is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:24 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC