Private Sub btnSearch_Click(sender As Object, e As EventArgs)Handles btnSearch.Click
'Searches for movie in listbox
Dim strDVDtitle As String
strDVDtitle = InputBox("Enter Movie Title:")
Dim X As Integer = 0
Dim bolDVDFound As Boolean = False
For X = 0 To count - 1
If DVDS(X).DVDtitle = strDVDtitle Then
txtDVDyear.Text = DVDS(X).DVDyear
txtDVDtitle.Text = DVDS(X).DVDtitle
txtDVDyear.Text = DVDS(X).DVDyear
txtDVDruntime.Text = DVDS(X).DVDruntime
txtDVDrating.Text = DVDS(X).DVDrating
bolDVDFound = True
End If
Next
If bolDVDFound = False Then
MessageBox.Show("Movie not found")
End If
End Sub
答案 0 :(得分:1)
您可以使用包含字符串方法,如下所示:
Dim actualTitle = "The Martian"
If actualTitle.ToLower().Contains(strDVDtitle.ToLower()) Then
MsgBox("Match!")
End If