I'm getting a error message on trying to add numbers from one textbox to another. The reason the error message is showing, is becasue I have a letter in the textbox, but is there way I can still preform a adding in the textbox. The error message I'm getting is 'Conversion from string "3R4416" to type 'Double' is not vaild.
Example:
TextBox5.Text = (TextBox2.Text + 1)
Let's say textbox2.text have the following item; 3K4416
Then I will need TextBox5.Text = 3K4417
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Button1.Enabled = False
Dim i As Integer
Do Until i = NumericUpDown1.Text
Dim SQLinsert As New SqlCommand
Dim SQLConnection As New SqlConnection
Try
TextBox4.Text = (TextBox1.Text + 1)
TextBox5.Text = (TextBox2.Text + 1) <<<<<< 'Getting an error message on this part....
TextBox1.Text = TextBox4.Text
TextBox2.Text = TextBox5.Text
SQLConnection.ConnectionString = "Server=10.53.252.221;UID=phasqladmin;PWD=i82dothis;Database=General KMMG Return log;Integrated Security=False"
SQLinsert.CommandText = "insert into DD_Labels ([Part Number], [Serial Number],[Trace Code],[Door], [Printed Date],[Printed By]) values ('" & ComboBox1.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & ComboBox2.Text & "','" & DateTimePicker1.Value & "','" & RichTextBox1.Text & "')"
SQLinsert.Connection = SQLConnection
SQLConnection.Open()
SQLinsert.ExecuteNonQuery()
SQLConnection.Close()
' MsgBox("This line has been repeated " & i & " times")
i = i + 1
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
Loop
End Sub
Example:
TextBox5.Text = (TextBox2.Text + 1)
Let's say textbox2.text have the following item; 3K4416
Then I will need TextBox5.Text = 3K4417
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Button1.Enabled = False
Dim i As Integer
Do Until i = NumericUpDown1.Text
Dim SQLinsert As New SqlCommand
Dim SQLConnection As New SqlConnection
Try
TextBox4.Text = (TextBox1.Text + 1)
TextBox5.Text = (TextBox2.Text + 1) <<<<<< 'Getting an error message on this part....
TextBox1.Text = TextBox4.Text
TextBox2.Text = TextBox5.Text
SQLConnection.ConnectionString = "Server=10.53.252.221;UID=phasqladmin;PWD=i82dothis;Database=General KMMG Return log;Integrated Security=False"
SQLinsert.CommandText = "insert into DD_Labels ([Part Number], [Serial Number],[Trace Code],[Door], [Printed Date],[Printed By]) values ('" & ComboBox1.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & ComboBox2.Text & "','" & DateTimePicker1.Value & "','" & RichTextBox1.Text & "')"
SQLinsert.Connection = SQLConnection
SQLConnection.Open()
SQLinsert.ExecuteNonQuery()
SQLConnection.Close()
' MsgBox("This line has been repeated " & i & " times")
i = i + 1
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
Loop
End Sub