How to extract a String number from a DataGridView C #

0

What I want is to take the numerical value of a string for example IMP_5, take only 5 that would be in the last row of a DataGridView. The last row of records of all you have.

Someone can help me.

    
asked by fredmar 13.11.2017 в 03:58
source

1 answer

1

This could be done using a regular expression.

Example:

        using System.Text.RegularExpressions;
        string soloNumeros = Regex.Match("IMP_5", @"\d+").Value;
        int numero = Convert.ToInt32(soloNumeros);
    
answered by 13.11.2017 / 04:06
source