private void _connectButton_Click(object sender, EventArgs e) { Chatroom room = (Chatroom)_roomListBox.SelectedItem; JObject changeRoomPacket = new JObject( new JProperty("CMD", "joinRoom"), new JProperty("Room", room.Name)); var json = changeRoomPacket.ToString(); byte[] data = Packet.CreateByteData(json); client.Send(data); room.AddUser(user); ChatRoomGUI chatGUI = new ChatRoomGUI(client, room, user); chatGUI.Text = room.Name; chatGUI.ShowDialog(); }