Number format exception

cnicolapc

Active Member
Licensed User
Longtime User
hi,
I'm trying to create a small converter to KCH kWh and Btu.
I want the values ​​are calculated in real time. (TextChanged).
when I insert the values ​​in the calculation is performed EditText Kwh IN KCH.
But if I use backspace to erase EditText kWh, appears an error number format exception.
attach example.
can you help me please?
Thank you
Nicola
 

kickaha

Well-Known Member
Licensed User
Longtime User
Test it to see if it is a number before using it
B4X:
Sub Kwh_TextChanged (Old As String, New As String)
      If IsNumber (New) Then Kch.Text=New*0.860
   End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…