C# Split Help

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];

}));
}


Answer this question

C# Split Help

  • Alan Z

    hi, The syntax has some errors. Can you give a more clear and specific one

  • C# Split Help