2 questions

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I'm creating a file compare app,(I know about windif) but i'm creating my
own, to add my own features.
I have several questions I'm stuck with to finish up my app.

1. I have a message box that is displayed with a OK and Cancel buttons. If
the user clicks OK I want to open the 2 different files. How can I determine
if the user clicks OK?

2. If OK is clicked I want to open both files the user is comparing and
display the contents of the file. How can I open the files to read? the
files will open in notepad of course.

I know theres windif, and other file compare tools, but i'm creating my own
to get a better understanding of what C# can do, and since we have a in
house source code managment tool, it has no file compare feature to it.
 
Hi Mike,


Mike said:
I'm creating a file compare app,(I know about windif) but i'm creating my
own, to add my own features.
I have several questions I'm stuck with to finish up my app.

1. I have a message box that is displayed with a OK and Cancel buttons. If
the user clicks OK I want to open the 2 different files. How can I determine
if the user clicks OK?

The return value of MessageBox.Show:

if ( MessageBox.Show( "Text", "Caption", MessageBoxButtons.OKCancel) ==
DialogResult.OK)
2. If OK is clicked I want to open both files the user is comparing and
display the contents of the file. How can I open the files to read? the
files will open in notepad of course.

How you will show the comparision if you show each file in notepad?


Cheers,
 
Hi Mike,
1. I have a message box that is displayed with a OK and Cancel buttons. If
the user clicks OK I want to open the 2 different files. How can I determine
if the user clicks OK?
If you use the MessageBox class its Show method returns DialogResult value
that carries the information about which button has been clicked

if(DialogResult.OK == MessageBox.Show(....))
{
//'Ok' button has been clicked on
}

B\rgds
100
 
at this time i'm not sure how to show the comparisions. Once I get the files
opened and displaying the contents in notepad I'll be happy, then I can
figure out how to show the compares
 
Hi Mike,

Well the whole point of a windif 's like program is that, how to show the
differences, you will have to show it yourself, not using notepad.

you don't need to open the files to display them in notepad, a sinple call
to Process.Start("c:\winnt\notepad " + filename ); can do it.

Hope this help,
 
OK, thanks
I'm going one step at a time with this
Ignacio Machin ( .NET/ C# MVP ) said:
Hi Mike,

Well the whole point of a windif 's like program is that, how to show the
differences, you will have to show it yourself, not using notepad.

you don't need to open the files to display them in notepad, a sinple call
to Process.Start("c:\winnt\notepad " + filename ); can do it.

Hope this help,
 
I tried that line to see how it works, and it errors out.

unrecognized escape sequence.

what does that mean?
 
Hi Mike,

It means that I typed it in OE :)
remember that you need to escape the \ character in a string:

Process.Start( @"c:\winnt\notepad.exe" + filename );

Will solve that, but please remember that it was just for show you how you
could do it, I haven't even tested if notepad is really in c:\winnt

Cheers,
 
Back
Top