EDN Admin
Well-known member
Greetings, Please help me to solve it.
Situation si like this: The desired final content (each run different) of my "master RichTextBox" is composed of contents of partial "slave RichTexBoxes" which can be filled from collection of almost hundreds of different RTF files accordingly to needs.
The slave Richtextboxes are filled by For-Next cycle picking RFT files content by certain algorithm. After filling all "slaves", following simple like procedure is applied:
slaveRichTextBox1.Focus()
slaveRichTextBox1.SelectAll()
slaveRichTextBox1.Copy()
MasterRichTextbox.Paste()
slaveRichTextBox2.Focus()
slaveRichTextBox2.SelectAll()
slaveRichTextBox2.Copy()
MasterRichTextbox.Paste()
...
(This repeats in cycle with about 10 different slave RTBoxes. Final copy/past action occurs almost 200x in one batch).
I suppose I have to use Copy/Paste, because when I LOAD desired content from RTF file directly into MasterRichTextBox, it will overwrite previous content. But this is not desired. Content must be "merged" one under other in the Master...
But, here is the problem: Loading lots of different_size_RTFcontents, copying and pasting them takes much more time to proceed in RichTextBoxes components then For-Next cycle to finish. Visual Basic crashes, I think becasuse let say Pasting process is not fully completed before another content gets its Focus and is trying to fill another box where... or read/write is not finished....or....HDD response (load larger file)...or...Focus is moved to another box faster than paste of previous is applied...or....
How to make the VisualBasic to wait to succesfull completition of copy/pasting process before another content is allowed to try to take place in the same RTbox in next cycle...?
Sleepin threads and Timer does not work for it.
VB crashes into: Context 0x2425c8 is disconnected. Releasing the interfaces from the current context (context 0x242458). This may cause corruption or data loss. To avoid this problem, please ensure that all contexts/apartments stay alive until the application is completely done with the RuntimeCallableWrappers that represent COM components that live inside them.
Thanks for any advice
View the full article
Situation si like this: The desired final content (each run different) of my "master RichTextBox" is composed of contents of partial "slave RichTexBoxes" which can be filled from collection of almost hundreds of different RTF files accordingly to needs.
The slave Richtextboxes are filled by For-Next cycle picking RFT files content by certain algorithm. After filling all "slaves", following simple like procedure is applied:
slaveRichTextBox1.Focus()
slaveRichTextBox1.SelectAll()
slaveRichTextBox1.Copy()
MasterRichTextbox.Paste()
slaveRichTextBox2.Focus()
slaveRichTextBox2.SelectAll()
slaveRichTextBox2.Copy()
MasterRichTextbox.Paste()
...
(This repeats in cycle with about 10 different slave RTBoxes. Final copy/past action occurs almost 200x in one batch).
I suppose I have to use Copy/Paste, because when I LOAD desired content from RTF file directly into MasterRichTextBox, it will overwrite previous content. But this is not desired. Content must be "merged" one under other in the Master...
But, here is the problem: Loading lots of different_size_RTFcontents, copying and pasting them takes much more time to proceed in RichTextBoxes components then For-Next cycle to finish. Visual Basic crashes, I think becasuse let say Pasting process is not fully completed before another content gets its Focus and is trying to fill another box where... or read/write is not finished....or....HDD response (load larger file)...or...Focus is moved to another box faster than paste of previous is applied...or....
How to make the VisualBasic to wait to succesfull completition of copy/pasting process before another content is allowed to try to take place in the same RTbox in next cycle...?
Sleepin threads and Timer does not work for it.
VB crashes into: Context 0x2425c8 is disconnected. Releasing the interfaces from the current context (context 0x242458). This may cause corruption or data loss. To avoid this problem, please ensure that all contexts/apartments stay alive until the application is completely done with the RuntimeCallableWrappers that represent COM components that live inside them.
Thanks for any advice
View the full article