making a chat application using windows forms

alright so im trying to make a chat application using windows forms. currently i have it set up so that client 1 and client 2 both connect to a server i have set up through visual studio. the server then handles sending messages between the two as well as storing said messages. ive got all the code that has to do with server communication figured out but my problem is using this with windows forms.

my issue is i dont know windows forms very well. im not sure where to put the code for connecting to and receiving messages from the server. what i need it to do is constantly be receiving messages from the server until a button is pressed. once a button is pressed i need it to stop waiting on messages and do the code i have setup for the button.

initially i just put the code in the form1 method but im fairly certain thats not the right thing to do, i assume theres some method that would make this possible but im having trouble figuring out what that might be. if there is a method could someone tell me what it is or if this is just impossible?

i tried to find support online and couldnt find anything that was particularly helpful yet. im going to continue looking but i decided to make this is the meantime in case someone might be around that can end my suffering.

submitted by /u/drag00n365
[link] [comments]

Leave a Reply