Skip to main content
GameDev.net gamedev.net
🔒 Locked

C# Split Function

Started by laura1316 Jan 10, 2007 at 11:31 AM 0 replies 1.1k views
Original Post
laura1316
laura1316
I am trying to split up the following packet. [rIA1004063P00T4EVC0G7F00L88] [rIA1004063P00T4EVC0G0100L88] I have text boxes for each seperated piece. I am trying to seperate what is in between r, P, T, V, G, and L. The code below shows how I use the split function to seperate the r from the P, it works the first time, but I am not sure why, when the second packet comes in, it does not go back to what is in between r and P but to what is between V and G and stays there. I receive a new packet every second and it just gets stuck between V and G. Why would this be? Do I need to dispose or do anything to the text box? Any help would be appereciated! Below is my code. private void ID(LogMsgType msgtype, string msg) { txtDeviceID.Invoke(new EventHandler(delegate { char[] delimiters = { 'D', 'r', 'P', 'T', 'V', 'G', 'L'}; string[] words = msg.Split(delimiters); txtDeviceID.Text = words[1]; })); }

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.