My program uses OCR dll to get text from other program. It copy and paste text to a text box. Can someone give me a code that will erase everything exept numbers or "." from a text box? Thank you for help!
Printable View
My program uses OCR dll to get text from other program. It copy and paste text to a text box. Can someone give me a code that will erase everything exept numbers or "." from a text box? Thank you for help!
We could give you the code, but why? This forum is for teaching and learning. If you want the entire code you can offer some money and then you might get it, otherwise why would someone else want you to take credit for their work?
If you want to actually learn we can help you, but we need to see what you've tried.
That aside, something like this would be very easy and would just involve looping through the string letter by letter and adding any characters 0-9 and . onto another string.
Don't loop, use RegEx.
You'll have to use Imports System.Text.RegularExpressions at the top of your code.Code:Dim sTest As String = "abc13def.190gh"
MessageBox.Show(Regex.Replace(sTest, "[^\d\.]", String.Empty))