Check to ensure that you're checking the IDE's Output tab is visible. The immediate window won't print anything sent via a Debug.Print however the debuggers Output pannel should show your output.
To ensure you're in the Output panel of the IDE click on the Main Menu button 'View' and select Output (or hold 'control+w' down and press 'o' on the keyboard)
Other information that will be in this window will also include the loading of resources and starting and ending of threads used by your application with addition to all of the compiler messages sent durring compilation. Assuming there is infact text in your MyFile.txt file, your Debug.Print calls should be writing here successfully.
Write to C# Immediate window in 2005
Mark Stega
Not Debug.WriteLine("X"); does nothing either. Here is
the code I tested.
private void button2_Click(object sender, EventArgs e){
StreamReader re = File.OpenText("c:\\MyFile.txt"); string input = null; while ((input = re.ReadLine()) != null){
Debug.Print(input); Debug.Write(input); Debug.WriteLine(input);}
re.Close();
}
Melchior91598
For a console app... try Console.WriteLine("Hello");
For a windows form app... try MessageBox.Show("Hello");
Hansjoerg
I want to write to the "Immediate Window" not
to a "messagebox" or the "console window"
Anyone know how
Thanks
kabirbasha
soli3d,
Check to ensure that you're checking the IDE's Output tab is visible. The immediate window won't print anything sent via a Debug.Print however the debuggers Output pannel should show your output.
To ensure you're in the Output panel of the IDE click on the Main Menu button 'View' and select Output (or hold 'control+w' down and press 'o' on the keyboard)
Other information that will be in this window will also include the loading of resources and starting and ending of threads used by your application with addition to all of the compiler messages sent durring compilation. Assuming there is infact text in your MyFile.txt file, your Debug.Print calls should be writing here successfully.
Good luck!
-Jonathan
MJ Mullen
Thanks All, I understand it's use, I just cannot get it to work. I tried
using
System.Diagnostics;Debug.Print ("testString");
Nothing gets printed to debug window. Any idea
wilrodmo
Jonathan, You're the man, works perfect.
Thanks everyone,
Paul
Siva M
newtWales
like
check out the complete article here
http://msdn2.microsoft.com/en-us/library/f177hahy.aspx
myemac
In my case:
Console.WriteLine( "Name:{0}, Address:{1}", my_dataReader["FirstName"], my_dataReader["Title"]);
Debug.Write ("AAA");
both print the string to Output window
I think the trick is to use Output window instead of immediate window
Cheers
Michael Luttmer
never mind. I closed the project, rebooted, and now it is magically working.
Richard Taylor
Hey,
I've got a similar problem. The debug statements are showing on the output window for all my classes except one.
I even put the stop point on one of them and when I ran the program, it moved the stop point down to the next executable line of code.
like I said, my other classes have debug statements and they are working fine.
here are two of the statements:
System.Diagnostics.Debug.WriteLine(_localDirectory + _fileDirName); System.Diagnostics.Debug.WriteLine("test ");During run time, I can hover over the values and I get the tool tip that shows the values.
Any ideas
Thanks,
Joanna.