I have a few BrowseDialogs to populate a few Business Objects, works great, untill someone types some characters into a field corresponding to a Double/Float in the database and then the BuildWhereElement method fails converting that string to a double. Ok, so we just add a Mask to the Float/Double field putting 10 '9's into the mask to give the user up to 10 spots to put in numbers only. This works in removing characters from the textbox, but with using 9's, they can add spaces to the textbox, as in '3473 747 7' and such. The same happens with 10 '0's as the mask. At this point I tried looking to the OnSearching Event to check the input, but wasn't getting this far, as at this point, there WhereClause is already/has tried to be built and it is too late to check the Input. So now I am looking to adding a small amount of code to the BuildWhereElement method so that
Case
DbType.Currency, DbType.DoubleloFieldValue.Add(
Double.Parse(CType(_CurrentValue, String)))might not throw an exception. I thought about possibly using Double.Tryparse but it works a little differently and would have to use a placeholder variable (no big deal) something maybe like
Dim
lnValue As DoubleDouble.TryParse(CType(_CurrentValue, String), lnValue)loFieldValue.Add(lnValue)
And this seems to fix the problem about putting spaces and putting characters into the textbox for our Double/Float fields, but I don't have the expertise to predict any future problems with this or other possible BrowseDialog side effects.
Any pointers on how we can make sure the user doesn't enter in any alpha characters and no spaces ?
*sigh* users...
Thanks
Robin Giltner