Logan Bender
Logan Bender

Reputation: 369

Debug.Write() works in MyClass but not in Form1 class

inside Form1.cs I added some Debug statements to trace user actions.

 private void button2_Click(object sender, EventArgs e)
    {
        System.Diagnostics.Debug.Write("user clicked: 'button1'");
        myClass.MyFunction();
    }

Similar statements work fine in other classes in this project, but not here. At one point earlier, this worked for Form1 but I can't isolate what changed. I know the button works because myClass.MyFunction gets called (and its Debug statements work) Any reason why this should be?

(my project settings/ build / checkbox "Define DEBUG constant" is checked)

[edit] I switched to using Console.WriteLine(), which seems to output to the Output Window when debugging. I dis not know that.

Upvotes: 0

Views: 84

Answers (2)

Marko
Marko

Reputation: 2734

Instead of

System.Diagnostics.Debug.Write("user Clicked:'button1');

Try

Console.WriteLine("user clicked: 'button1'");

Upvotes: 1

Khurram Ali
Khurram Ali

Reputation: 1679

I am not sure what you want and where u have stuck. but anyhow use a break point to debug your code ... and use

MessageBox.Show("user Clicked:'button1');

instead of this

system.Diagnostics.Debug.Write("user Clicked:'button1');

Would you tell me more what you are trying to do....?

Upvotes: 0

Related Questions