问题描述
嗨组,
我有一个带有文本框控件的表单。我正在使用文本框
控件启用多行,输出我运行的
长进程的''log''信息。我的问题是它一切正常,直到
达到文本框大小的文本大小。这导致
文本框停止更新,同时运行该过程的线程
继续。
任何想法我如何扩展文本框的功能接受
更大量的数据?我尝试了一个richtextbox,但它给了我同样的问题。没错,任何不同控件的想法我都可以使用
来代替VB 2003?
我不能使用列表框因为我需要用户来能够在一行上突出显示
部分文本或部分文本,并将它们复制到
剪贴板。
TIA
Hi group,
I have a form with a textbox control on it. I am using the textbox
control with multiline enabled to output the ''log'' information for a
long process I am running. My problem is that it all works fine until
the limit of the size of text is reached for the text box. This causes
the textbox to stop update whilst the thread running the process
continues.
Any ideas how I can expand the functionality of the textbox to accept
larger amounts of data? I tried a richtextbox but it gives me the same
problem. Failing that, any ideas of a different control I could use
instead that comes with VB 2003?
I cannot use a listbox because I need the user to be able to highlight
sections of text or parts of text on one line and copy them to the
clipboard.
TIA
推荐答案
你写入控件的数据量是多少?请注意,机器
只有有限的内存。除此之外,请确保使用
''Control.InvokeRequired'',''Control.Invoke''/''Control.BeginInvoke''更新
来自另一个线程的控件而不是直接访问它,这将导致问题,因为Windows Forms控件的实例成员不是多线程安全的
。
-
MS Herfried K. Wagner
MVP< URL:http://dotnet.mvps.org/>
VB< URL:http://classicvb.org/petition/>
Which amount of data are you writing to the control? Note that the machine
only has a limited memory. In addition to that, make sure you use
''Control.InvokeRequired'', ''Control.Invoke''/''Control.BeginInvoke'' to update
the control from another thread instead of accessing it directly, which will
cause problems because instance members of Windows Forms controls are not
safe for multithreading.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
文本不是那么多,如果它被保存为记事本中的文本文件,不应该增长到超过1或2 mb的纯文本,所以内存应该是
不是据我所知,这个问题。 2mb'远远大于文本框或Richtextbox控件可以处理的
。有什么想法吗?
p.s.我正在使用invoke来更新控件!谢谢!
It is not that much text, should not grow to more than 1 or 2 mb''s of
pure text if it was saved as a text file in notepad, so memory should
not be a problem as far as I can tell. 2mb''s is far greater than what
the Textbox or Richtextbox control can handle though. Any ideas?
p.s. I am using invoke to update the control already! thanks!
文本不是那么多,不应该增长如果将纯文本保存为记事本中的文本文件,则超过1或2 mb的纯文本,因此,就我所知,内存应该不是问题。 2mb'远远大于Textbox或Richtextbox控件可以处理的内容。有什么想法吗?
p.s.我正在使用invoke来更新控件!谢谢!
It is not that much text, should not grow to more than 1 or 2 mb''s of
pure text if it was saved as a text file in notepad, so memory should
not be a problem as far as I can tell. 2mb''s is far greater than what
the Textbox or Richtextbox control can handle though. Any ideas?
p.s. I am using invoke to update the control already! thanks!
文本框可以轻松处理...除非你正在运行Win9x。
-
Rinze van Huizen
C-Services Holland bv
The textbox can easily handle that... unless you''re running Win9x.
--
Rinze van Huizen
C-Services Holland b.v
这篇关于增加文本框的限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!