Ver Mensaje Individual
  #6  
Antiguo 29-10-2023
REHome REHome is offline
Miembro
 
Registrado: jul 2003
Ubicación: España
Posts: 454
Reputación: 21
REHome Va por buen camino
Me funciona de maravilla.

Código:
using System;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace Termite_SAI_01
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button_Enviar_Click(object sender, EventArgs e)
        {
            string expresionRegular = @"#I(.*)O(.*)L(.*)B(.*)V(.*)F(.*)H(.*)R(.*)S(.*)";
            Regex rx = new Regex(expresionRegular,
                   RegexOptions.Compiled | RegexOptions.IgnoreCase);

            string texto = "#I225.7O226.2L006B100V25.7F50.2H50.2R0080S€„€ˆ„À";

            MatchCollection matches = rx.Matches(texto);
            textBox_I.Text = matches[0].Groups[1].Value;
            textBox_O.Text = matches[0].Groups[2].Value;
            textBox_L.Text = matches[0].Groups[3].Value;
            textBox_B.Text = matches[0].Groups[4].Value;
            textBox_V.Text = matches[0].Groups[5].Value;
            textBox_F.Text = matches[0].Groups[6].Value;
            textBox_H.Text = matches[0].Groups[7].Value;
            textBox_R.Text = matches[0].Groups[8].Value;
            //textBox_S.Text = matches[0].Groups[9].Value;

            MessageBox.Show("Ya se procesó la cadena");
        }
    }
}
Muchas gracias mi muy distinguido amigo.
__________________
http://electronica-pic.blogspot.com....n-arduino.html Manuales de electrónica general, PIC y Arduino.
Responder Con Cita