|
Hey all,
I have a few text boxes on my form that read from the DB. I want to display these values as currency. However, sometimes these values maybe null in the database, so the following will crash:
FarmTrimPriceTextBox.Text = FormatCurrency(FarmsBindingSource.Current("FarmTrimPrice"), 2)
I also tried If FarmsBindingSource.Current("FarmTrimPrice").IsDBNull(12) = False Then FarmTrimPriceTextBox.Text = FormatCurrency(FarmsBindingSource.Current("FarmTrimPrice"), 2) End If but this also fails with the followign error message: Public member 'IsDBNull' on type 'DBNull' not found.
Neither of these work either:
If FarmsBindingSource.Current("FarmTrimPrice") <> Nothing Then FarmTrimPriceTextBox.Text = FormatCurrency(FarmsBindingSource.Current("FarmTrimPrice"), 2) End If
If FarmsBindingSource.Current("FarmTrimPrice") = Nothing Then Else FarmTrimPriceTextBox.Text = FormatCurrency(FarmsBindingSource.Current("FarmTrimPrice"), 2) End If
How do I determine if they are null, and if not, format them? I would love to just use FormatCurrency in the Query, but I am using SQL CE which errors out when I try using FormatCurrency in the query.
|