Page 1 of 1
Problem: outputting compiler info
Posted: Tue Apr 01, 2008 10:39 am
by demonmaster3k
While I was following some advice given to me (I don't exactly remember who told me to do it), I came across a problem. What I'm trying to do here is create output text that is written to a textbox when an action has been done within the program. For example, when the user presses the compile button on one of my two functional compilers, I want to be able to display the output text from Tool.exe in the textbox. The compiler window is an MDI form, the textbox for logging is not (it's contained in a pannel that's part of a toolset called Dock Manager).
below is an image of how my program looks like:
This program is written in C#. How would i go about fixing my problem.
Posted: Tue Apr 01, 2008 11:30 am
by grimdoomer
In the click procedure add this:
Posted: Wed Apr 02, 2008 6:13 am
by Patrickssj6
Deleting this post cause Korn said so
Posted: Wed Apr 02, 2008 6:19 am
by kornman00
Patrickssj6 wrote:For strings use
uhm, no...
And he states he is using C#. Stop trying to spread virii.
Posted: Wed Apr 02, 2008 6:26 am
by Patrickssj6
>.>
Posted: Wed Apr 02, 2008 2:14 pm
by kornman00
<.<
more clarity
Posted: Wed Apr 02, 2008 5:33 pm
by demonmaster3k
ok maybe i wasn't clear enough in my first post. The text box is in the MDI parent form and is contained within a docking tool i got off of the internet. what i tried to do was this:
Main.cs (form)
Code: Select all
//using statements
//constructor
private string editLog="";
public string outputText
{
get
{
editLog += logBox.Text;
return editLog;
}
set
{ editlog=value; }
}
//rest of code
Compiler.cs (child form)
Code: Select all
//using statements
//constructor
main logger=main();
//event handler
private void compilerBtn_Click(object sender, EventArgs e)
{
//compiler code
//get output message to output textbox
logger.outputText += (DateTime.Now+" output message "+copileDir.Text+".");
}
//rest of code
when i run the code in debug mode, VS throws an exception. i'm coding in VS 2008 Pro if that helps any.
i hope that helps you answer the question a little easier.
Posted: Wed Apr 02, 2008 6:03 pm
by xbox7887
Care to post the exception message with stack trace?
Posted: Wed Apr 02, 2008 6:36 pm
by demonmaster3k
xbox7887 wrote:Care to post the exception message with stack trace?
oh right sorry i'll get that up right away.
Visual Studio Exception wrote:Win32 Exception Was Unhandled
Error creating window handle.
Code: Select all
this.groupbox5.controls.add(this.collisionCompile);
I didn't see any call stack notices
and the code that appeared in the exception had nothing to do with what the logging that i was trying to do. there was no message attached to the that button.
The funny thing is that an insertion like what i've attempted to do works with the parent form->child form, but not the other way around.
similar code from script template editor:
Code: Select all
//event handler code
private void button1_Click(object sender, EventArgs e)
{
//instantate the form
childform aform = new childform();
//set the mdi parent
aform.mdiparent = this;
//create the output text
aform.editText+="script text";
//show the form
aform.show()
}
the above works no problem (but what i tried to do was vitureally the same thing in reverse, but it won't work)
Posted: Wed Apr 02, 2008 7:19 pm
by kornman00
Ever think that the exception is being caused by something else
besides from the code of what you're trying to do?...
There are far too little details to really debug your problem, especially over a thread...
And your coding standards make me want to cry
(no offense).
Posted: Wed Apr 02, 2008 7:21 pm
by Supermodder911
kornman00 wrote:
And your coding standards make me want to cry
(no offense).
I must agree.
Posted: Thu Apr 03, 2008 8:02 am
by demonmaster3k
Ok i confirmed it, the problem is not in the code i made in an attempt to transfer the message over to the output textbox. However, the text will not write to the output textbox. Since my code practice (according to kornman00) isn't that great (and i value that crit) are there any suggestions to improve my code? and what can i do to fix this problem?