Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printing data to Edit Control Box

Status
Not open for further replies.

paul51

Programmer
May 19, 2000
38
US
I have found that when I write to a Edit control box using a Cedit member (while updating with ReplaceSel)eventually the field stops updating.<br><br>void CFieldDlg::OnTestEdit() <br>{<br>char buf[1150];<br>int num=0;<br>for(int i=0;i&lt;20000;i++)<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;num=num+1;<br>&nbsp;&nbsp;&nbsp;sprintf(buf,&quot;%i&quot;,num);<br>&nbsp;&nbsp;&nbsp;m_edit.ReplaceSel(&quot;\r\n&quot;);<br>&nbsp;&nbsp;&nbsp;m_edit.ReplaceSel(buf);<br>&nbsp;&nbsp;}<br>}<br><br>**This will only update up to 4339, then the field &quot;locks up&quot;.<br><br>When I use a Cstring member, the field will not update until the full routine is completed.<br><br>void CFieldDlg::OnTestString() <br>{<br>char buf[50];<br>int num;<br>int i=0;<br><br>num=5;<br>sprintf(buf,&quot;%i&quot;,num);<br>m_string=buf;<br>UpdateData(FALSE);<br><br>Sleep(3000);<br><br>num=6;<br>sprintf(buf,&quot;%i&quot;,num);<br>m_string=buf;<br>UpdateData(FALSE);<br>}<br><br>**Only '6' prints to the field.&nbsp;&nbsp;The 5 is not updated.<br><br><br>Can anyone help me with a real time, unlimited updating feature?<br>
 
HI,<br><br>i am not sure i understand ur question properly.<br>but try this code.<br><br>void CSomeClass::SomeFunc()<br>{<br>&nbsp;&nbsp;&nbsp;// Assuming IDC_EDIT1 is your EditControl<br>&nbsp;&nbsp;&nbsp;int nCnt = 0 ;<br>&nbsp;&nbsp;&nbsp;CString str ;<br>&nbsp;&nbsp;&nbsp;while(nCnt &lt; 20000)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nCnt++ ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str.Format(&quot;%d&quot;,nCnt) ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GetDlgItem(IDC_EDIT1)-&gt;SetWindowText(str) ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sleep(3000) ;<br>&nbsp;&nbsp;&nbsp;}<br>}<br> <p>GuruPrasad Belthur<br><a href=mailto:belthurgp@yahoo.com>belthurgp@yahoo.com</a><br><a href= Personal Page</a><br>Commerce Graduate, but have lived purely on computers. All the work i have done till now is only with computers and I love it.
 
HI,<br><br>try this code.<br><br>void CSomeClass::SomeFunc()<br>{<br>&nbsp;&nbsp;&nbsp;// Assuming IDC_EDIT1 is your EditControl<br>&nbsp;&nbsp;&nbsp;int nCnt = 0 ;<br>&nbsp;&nbsp;&nbsp;CString str ;<br>&nbsp;&nbsp;&nbsp;while(nCnt &lt; 20000)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nCnt++ ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str.Format(&quot;%d&quot;,nCnt) ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GetDlgItem(IDC_EDIT1)-&gt;SetWindowText(str) ;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sleep(3000) ;<br>&nbsp;&nbsp;&nbsp;}<br>}<br> <p>GuruPrasad Belthur<br><a href=mailto:belthurgp@yahoo.com>belthurgp@yahoo.com</a><br><a href= Personal Page</a><br>Commerce Graduate, but have lived purely on computers. All the work i have done till now is only with computers and I love it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top