lundi 19 juillet 2021

How to give a specific pattern to a textbox in windows form C#

I am working in a c# windows form application and I need to have the below explained pattern in a textbox.

First: Numeric value (0123456789)

Second: One of arithmetic - multiply, plus, minus, or divide (+*-/)

Third: Decimal number (.)

Below are the examples

1234567890*17.325 or

1234567890+17.325 or

1234567890-17.325 or

1234567890/17.325

It should allow to type only numbers and arithmetic in the textbox and should not repeat arithmetic.

After validating, those 3 components should be taken into 3 cells in a datagridview separately when a command button is clicked.

Ex:

  • Number to Column 1 (123456789)

  • One of arithmetic to Column 2 (+,-,* or /)

  • Decimal number to Column 3 (17.325)

How can I do this? Any help would be much appreciated.

Aucun commentaire:

Enregistrer un commentaire