Click here to Skip to main content
15,917,060 members
Home / Discussions / C#
   

C#

 
AnswerRe: Detecting a port Pin
enjoycrack4-Nov-05 11:41
enjoycrack4-Nov-05 11:41 
QuestionElegant check for .Net Framework 1.1 or 2.0? Pin
Tom Ollar4-Nov-05 9:21
Tom Ollar4-Nov-05 9:21 
AnswerRe: Elegant check for .Net Framework 1.1 or 2.0? Pin
Carl Mercier4-Nov-05 10:22
Carl Mercier4-Nov-05 10:22 
GeneralRe: Elegant check for .Net Framework 1.1 or 2.0? Pin
Tom Ollar5-Nov-05 3:58
Tom Ollar5-Nov-05 3:58 
AnswerRe: Elegant check for .Net Framework 1.1 or 2.0? Pin
leppie4-Nov-05 21:51
leppie4-Nov-05 21:51 
GeneralRe: Elegant check for .Net Framework 1.1 or 2.0? Pin
Tom Ollar5-Nov-05 4:15
Tom Ollar5-Nov-05 4:15 
QuestionConsuming image-generating web service in Excel Pin
julian_l4-Nov-05 8:41
julian_l4-Nov-05 8:41 
Questionwinform app Pin
Manu_814-Nov-05 8:25
Manu_814-Nov-05 8:25 
AnswerRe: winform app Pin
IdUnknown4-Nov-05 9:15
IdUnknown4-Nov-05 9:15 
GeneralRe: winform app Pin
Manu_814-Nov-05 9:19
Manu_814-Nov-05 9:19 
AnswerRe: winform app Pin
Carl Mercier4-Nov-05 10:26
Carl Mercier4-Nov-05 10:26 
QuestionHow to recognize a string's colour Pin
ventomito4-Nov-05 6:56
ventomito4-Nov-05 6:56 
AnswerRe: How to recognize a string's colour Pin
S. Senthil Kumar4-Nov-05 21:33
S. Senthil Kumar4-Nov-05 21:33 
QuestionHow to get started developing a control Pin
BambooMoon4-Nov-05 6:52
BambooMoon4-Nov-05 6:52 
QuestionHow to check object==null for objects without Constructor? Pin
artisticcheese4-Nov-05 6:05
artisticcheese4-Nov-05 6:05 
AnswerRe: How to check object==null for objects without Constructor? Pin
whizzs4-Nov-05 7:27
whizzs4-Nov-05 7:27 
QuestionLoading Files Pin
zaboboa4-Nov-05 5:53
zaboboa4-Nov-05 5:53 
AnswerRe: Loading Files Pin
User 66584-Nov-05 7:32
User 66584-Nov-05 7:32 
GeneralRe: Loading Files Pin
zaboboa4-Nov-05 8:13
zaboboa4-Nov-05 8:13 
AnswerRe: Loading Files Pin
whizzs4-Nov-05 7:37
whizzs4-Nov-05 7:37 
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 }
}

AnswerRe: Loading Files Pin
Jon Rista4-Nov-05 16:16
Jon Rista4-Nov-05 16:16 
Questionget GC to collect unused memory Pin
Stefan Fohringer4-Nov-05 5:06
Stefan Fohringer4-Nov-05 5:06 
AnswerRe: get GC to collect unused memory Pin
Dan Neely4-Nov-05 5:32
Dan Neely4-Nov-05 5:32 
AnswerRe: get GC to collect unused memory Pin
Dave Kreskowiak4-Nov-05 5:52
mveDave Kreskowiak4-Nov-05 5:52 
GeneralRe: get GC to collect unused memory Pin
Jon Rista4-Nov-05 16:33
Jon Rista4-Nov-05 16:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.