Problem with RichTextBox rendering
I have a server that receives messages from clients, the problem is. when i click on the tabGroup for the Message receiver and then the client sends a message, its fine. But if they send a message before I open the tabGroub this error occurs. The message goes into a RichTextBox btw
31 Replies
Wildly guessing here, but I dont think there is a proper solution to this, just a work around - make sure that tab gets visited before any message is received.
Potentially by making it the default tab, or just force swapping to it at least once
how is the tab pages and controls added?
because I have no such issue out of the box that updating the richtextbox crashes without having the tab page open
I assume u might be doing one of the 2, updating it from a different thread
creating it dinamycally and updating it
updating from a non-UI thread seems like a likely guess
if that is the case, the easiest fix is to just wrap the actual update of the UI (ie textbox.Add or whatever) in an action and pass it to
form.Dispatcher
`
HandleClientComm method is inside the TcpServer class
that is not enough information unhappily
do u have a github of this project?
Yes but its private
can you unprivate it for a bit?
No permissions
well we need t oknow how the tabcontrol is added
how the pages are added
and how the logger gets there
(and how the tcpserver is threaded)
Ok ill provide everything
we also need 1 bar of gold each
Sure, I gotchu after
$paste
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
:catlaugh:
BlazeBin - nmbvofjmfbwx
A tool for sharing your source code with the world!
I'm guessing this is how the RichTextBox is getting added
BlazeBin - emqxqprdumqo
A tool for sharing your source code with the world!
And this is how the TcpServer runs
yep looks good
ah I see so the window and hidden and u want to update the box?
Well, in the second paste thats a different form
Just asking for a port number, which then starts the server and runs the main form
ah ok
BlazeBin - hpdfawvxfhkx
A tool for sharing your source code with the world!
TcpServer class
can u show the form where the tabs are
Sorry to hijack but @leowest I need your help for an urgent thing, check your dms real quick
The code or what
is it the serverinfo?
No
That would be the main form
akjshdjaksd
so you keep it hidden
after u take the input
What do you mean by take the input
Like the message?
From the client*
Even when the main form is open and the TaskLogger (RichTextBox) hasn't been loaded, it still crashes