visual studio 2010 need text box updating inside of loop

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<span style="font-family:monospace; line-height:17px; white-space:pre I am trying to display com port data in a multi-line textbox using visual studio c++ 2010. But, I am not
<span style="font-family:monospace; line-height:17px; white-space:pre able to see the data update in real time. The only way I can view my data is by clicking my button3. I
<span style="font-family:monospace; line-height:17px; white-space:pre want to be able to click that button and start viewing my data and log it. I tried to put my text box
<span style="font-family:monospace; line-height:17px; white-space:pre update inside of a while statement and of course it freezes my program. I tried to use threads for this
<span style="font-family:monospace; line-height:17px; white-space:pre and read that threads do not
" id="x__GPLITA_0" title="Click to Continue > by Savings Sidekick work in visual studio 2010. Is there any way that I can update my textbox <span style=" style="text-decoration:underline
this way and see all of my data as I receive it?
<pre class="prettyprint" style=" private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {

if(this-> serialPort1->IsOpen){

try{
this->textBox1->Text=this->serialPort1->ReadExisting() + "rn";
}
catch(TimeoutException^){
this->textBox1->Text="Timeout Exception";

}
}

}[/code]
I need to be able to view my text box updating in real time. If there is a way of doing this also without downloading an external library I would prefer it that way. Thanks in advance for the help! Also, I tried putting my code into VS2012 so I could use
the threads there and it prompted me to do the update on my code. I did and still received errors and was unable to debug. In 2010 my code runs with no errors but I am unable to resolve this issue.


<br/>


View the full article
 
Back
Top