![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Dec 2007
Location: Durban, South-Africa
Posts: 194
Rep Power: 1
![]() |
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 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.
__________________
Be kinder than necessary because everyone you meet is fighting some kind of battle. |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Re: C# Streams and Installer Question
Specify a path:
StreamWriter stmWrite = new StreamWriter(@"C:\Path\To\Directory\" + rtbSaveName.Text); |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: Dec 2007
Location: Durban, South-Africa
Posts: 194
Rep Power: 1
![]() |
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<
__________________
Be kinder than necessary because everyone you meet is fighting some kind of battle. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|