Original Post
Hello everyone, I am new to this site and this is my first post. I am relatively new to programming and this is the first program Ive ever written with networking support. Please bear with me as I already know I am new, my methods are inefficient, and I might ask stupid questions. What I am trying to accomplish is the population of a listbox on my client to match an array on the server (its like a chatroom where a list on the side contains all the connected peoples' names). I kind of understand what I am supposed to do but I do not know how I am supposed to do it. I do not really understand arrays and I have never worked with them before. *Please give me the simplest solution, as long as it works* I have a client and server application that communicate using system.net.sockets. In my code there is a section of code that executes every time a client connects. What I need to do every time a client connects is store the name that the client sends as the next item in an array, and then broadcast the array from the server to all clients, and then interpret the received array by the client so that it can update the listbox to include the new data. I THINK I understand how to do the sending part. I can use the array.join method to concatenate it into a string, delimited by a chosen character, send the string, and then use the Split() function with the same chosen character to split the string back up into its original values. I THINK I can update the listbox by deleting it, then making a loop that will add each of the split values in order into it. This might not be the best method but I understand it and I hope it will work, correct me if it won't. What I DON'T know how to do is create an array that I can keep adding to as people join. In my Sub Main() section I have a counter section of code that executes on AccpetTCPClient(). From there it receives the clients name and broadcasts a connection message and whatnot... so I assume this is where I would stick their name into the array. So, I guess I could've avoided all of this writing and simply asked, "How do I create an array with no defined size (or would I just reDim the array to 1 more each time), and then how do I add data into that array?" but I like to be difficult apparently. Any and all help is greatly appreciated because I am ready to pull my hair out... Thank you in advance