|
|
| Write to C# Immediate window in 2005 |
|
| Author |
Message |
soli3d

|
Posted: Visual C# General, Write to C# Immediate window in 2005 |
Top |
How do we write to the immediate window from the code
window. Similar to "Debug.Print" in VB.
Thank you,
Paul
Visual C#16
|
| |
|
| |
 |
jason duncan

|
Posted: Visual C# General, Write to C# Immediate window in 2005 |
Top |
For a console app... try Console.WriteLine("Hello");
For a windows form app... try MessageBox.Show("Hello");
|
| |
|
| |
 |
soli3d

|
Posted: Visual C# General, Write to C# Immediate window in 2005 |
Top |
I want to write to the "Immediate Window" not
to a "messagebox" or the "console window"
Anyone know how
Thanks
|
| |
|
| |
 |
Ali Raza Shaikh

|
Posted: Visual C# General, Write to C# Immediate window in 2005 |
Top |
The Immediate window is used to debug and evaluate expressions, execute
statements, print variable values, and so forth.
like
>Debug.Print varA // this is used to print the value of VarA
check out the complete article here
http://msdn2.microsoft.com/en-us/library/f177hahy.aspx
|
| |
|
| |
 |
soli3d

|
Posted: Visual C# General, Write to C# Immediate window in 2005 |
Top |
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
|
| |
|
| |
 |
Ali Raza Shaikh

|
Posted: Visual C# General, Write to C# Immediate window in 2005 |
Top |
Debug.WriteLine("AnyString"); // is this working , and your compliation = Debug Mode
|
| |
|
| |
 |
soli3d

|
Posted: Visual C# General, Write to C# Immediate window in 2005 |
Top |
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();
}
|
| |
|
| |
 |
Jonathan MacCollum

|
Posted: Visual C# General, Write to C# Immediate window in 2005 |
Top |
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
|
| |
|
| |
 |
soli3d

|
Posted: Visual C# General, Write to C# Immediate window in 2005 |
Top |
Jonathan, You're the man, works perfect.
Thanks everyone,
Paul
|
| |
|
| |
 |
JustLearninC#

|
Posted: Visual C# General, Write to C# Immediate window in 2005 |
Top |
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.
|
| |
|
| |
 |
JustLearninC#

|
Posted: Visual C# General, Write to C# Immediate window in 2005 |
Top |
never mind. I closed the project, rebooted, and now it is magically working.
|
| |
|
| |
 |
Batikit

|
Posted: Visual C# General, Write to C# Immediate window in 2005 |
Top |
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
|
| |
|
| |
 |
| |
|