Click here to Skip to main content
15,904,497 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is my code

VB
Dim ok As Integer
Dim kk As Integer
Dim ik As Integer
Private Sub cb1_TextChanged(sender As System.Object, e As System.EventArgs) Handles cb1.TextChanged
    ok = Convert.ToInt32(cb1.Text)
    ok = CInt(cb1.Text)
    kk = Convert.ToInt32(cb2.Text)
    kk = CInt(cb2.Text)
    ik = Convert.ToInt32(cb3.Text)
    ik = CInt(cb3.Text)
end sub


and this is my error

Input string was not in a correct format.
I get the error when I change a number i the combobox, cb1 = combobox1
Posted

1 solution

That is going to depend on your data - i.e. whatever the user types.
If you just want a number, why not use a NumericUpDown - they can even apply upper and lower limits.

Alternatively, use the Int32.TryParse[^] method instead?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900