Hi... How do I get output debug messages generated by the debug mode (ie. Start with debugging)? If I can get them, I wish to display them to listbox that I have in the windows form I created. Is there a smarter way other than using the following? :

lstDebugMessage.Items.Add("Whatever is inside debug message");

Where lstDebugMessage is the listbox I generated in my windows form. Thanks for any ideas!

So, if I understand correctly, when an error is thrown you want to add the error Message (the text) to a listbox?

If so this should do it.

THis example the program trys to open that file, and since it doesnt exist, its add the error to the listbox.

try
            {
                File.Open("C:\\dasdsds.txt",FileMode.Open);//Try to open

            }
            catch (Exception error)
            {
                listBox1.Items.Add(error.Message);
            }

Hope that helps :).

Erm sorry... not error messages. Some of my dlls generate some data output that prints to the console output screen (also same as debug output screen). I want to read the console output messages that my dlls generate. Sorry for the misunderstanding...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.