Loading Files
-
Hello, I am loading a file within my app and the way I am refering to it is something like that:
this.richTextBox1.LoadFile("c:\\tmp\\Document.rtf");
However if I want to deploy the application on some other machine, obviously the file will not be there. So, if I want to include the file in my application how do I refer to the file then? Thank you. -
Hello, I am loading a file within my app and the way I am refering to it is something like that:
this.richTextBox1.LoadFile("c:\\tmp\\Document.rtf");
However if I want to deploy the application on some other machine, obviously the file will not be there. So, if I want to include the file in my application how do I refer to the file then? Thank you. -
Hello, I am loading a file within my app and the way I am refering to it is something like that:
this.richTextBox1.LoadFile("c:\\tmp\\Document.rtf");
However if I want to deploy the application on some other machine, obviously the file will not be there. So, if I want to include the file in my application how do I refer to the file then? Thank you.zaboboa wrote:
Hello, I am loading a file within my app and the way I am refering to it is something like that: this.richTextBox1.LoadFile("c:\\tmp\\Document.rtf"); However if I want to deploy the application on some other machine, obviously the file will not be there. So, if I want to include the file in my application how do I refer to the file then? Thank you.
Is the file something you will deploy with your code? If so you will know where it should be. You could try something like this:
try
{
this.richTextBox1.LoadFile("c:\\tmp\\Document.rtf"); //of course point to where you think it is
}
catch
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "Please locate Document.rtf"; //or whatever title you want
ofd.Filter = "RTF File|*.rft";
ofd.ShowDialog();if ( ofd.FileName != "" ) { this.richTextBox1.LoadFile( ofd.FileName ); }
else { // do something to handle the error }
} -
Just put it in your application'S folder and do a
this.richTextBox1.LoadFile("Document.rtf");
You might also insert the file as a resourceHi, I am using : Help.ShowHelp (this, "Help\\EconomicAssessmentHelp.chm"); whre Help is the folder in my application folder (the one that contains the solution and all the clasees, forms, etc...). But the statement above still does not work, unless I provide the whole path. Which is "C:\\MyDocuments\.... etc. Any ideas why it does not work? Thank you
-
Hello, I am loading a file within my app and the way I am refering to it is something like that:
this.richTextBox1.LoadFile("c:\\tmp\\Document.rtf");
However if I want to deploy the application on some other machine, obviously the file will not be there. So, if I want to include the file in my application how do I refer to the file then? Thank you.