How to convert Strings to Integer with CInt()


cint.png
' Gambas class file

PUBLIC SUB Button1_Click()
  x AS Integer
  x = CInt(TextBox1.Text) + CInt(TextBox2.Text)
  'this throws an error if the input does not excactly
  'looks like an integer!
  'so better use val()
  Label2.Text = CStr(x)
END

-- JochenGeorges - 28 Dec 2004