Alright so i've done this in some of my recent programs with option strict on and for some reason When i debug and select the option from the combo box, it crashes and gives me a 'Input String was not in the correct format' error. Ive tried declaring the variables as strings and converting the textbox to integer from there and still get the same thing. I'm just trying to get a value to store it in that variable so i can use it for later calculations. Theres a lot more to it, but considering i'm getting this so early i don't wanna continue until i get it right.
Code:
Option Strict On Option Explicit On Public Class Form1 Private Sub cboCommute_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboCommute.SelectedIndexChanged Dim intCommuteChoice As Integer intCommuteChoice = Me.cboCommute.SelectedIndex Select Case intCommuteChoice Case 0 CarCommute() End Select End Sub Private Sub CarCommute() Me.GroupBox1.Visible = True Dim intlabel1 As Integer Dim intlabel2 As Integer intlabel1 = Convert.ToInt32(Me.Label1.Text) intlabel2 = Convert.ToInt32(Me.Label2.Text) End Sub End Class
Comment