How to compare combobox item to the first 10 digits value in textbox

  • Thread starter Thread starter BONITOS
  • Start date Start date
B

BONITOS

Guest
Hi All,

I want to make a program that will compare the selected items of combo box to the first 10 digits value of text box, user can input up to 24 digits serial no. from the text box. and I will set default value to the items of combo box. example see my code below.
I don't know what to use if else , or select case,
Please help me thank you in advance.


Public Class Form1
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
' Case 1
If cmbModel.SelectedItem.text <> "" Then
MsgBox("Choose model")
End If
' case 2
If cmbModel.SelectedItem.text = "PBGS01 (MR SENSOR)" Then
If txtSerialNo.Text = "11150PP20000%" Then
MsgBox("Success")

Else
MsgBox("Model and Serial no not match !")
End If
End If
' case 3
If cmbModel.SelectedItem.text = "PBGE01 (ECU BOARD)" Then
If txtSerialNo.Text = "38700BD20101%" Then
MsgBox("Success")

Else
MsgBox("You select wrong Model")
End If
End If
' case 4
If cmbModel.SelectedItem.text = "PBGM01 (MCU BOARD)" Then
If txtSerialNo.Text = "12110PP20000%" Then
MsgBox("Success")

Else
MsgBox("You select wrong Model")
End If
End If
End Sub
End Class


thank you in advanced.

Continue reading...
 
Back
Top