I will get data in DataTable. I am going to iterate data in foreach. I will have all types of data in Datatable. Now I need to find Double for each item (string) in DataTable. How to find IsDouble for string?
Ex:
I have "21342.2121" string. I need to covert this to Double. But sometimes the data will be "TextString". So I can't use Double.Parse().
How to handle this?
Dim val as Double
Double.TryParse("MyString", val)
Double.TryParse("1234.567", val)
First TryParse() will return false. Second TryParse() will return true and place 1234.567 into val.
Try Double.TryParse. This will return false if the number is not in a valid/recognized format, allowing you to do whatever you need to do in this scenario.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With