0
我正在開始將用戶輸入的數據從文本框和組合框存儲到列表中作爲單個字符串,然後在調用時檢索該特定數據。VB.NET如何在List(Of T)中存儲文本框數據並在調用時檢索所述數據
Public Class BMGSwimmingSports
'Creates a list
Dim Participants As List(Of String) = New List(Of String)
Private Sub btnAddStudent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddStudent.Click
'Stores inputed data from text boxes and combo boxes in a list then clears the text and combo boxes
Participants.Add(txtGivenName.Text + ", " + txtSurname.Text + ", " + cmbGender.Text + ", " + cmbYearLevel.Text + ", " + cmbEvent.Text + ".")
txtGivenName.Text = ""
txtSurname.Text = ""
cmbEvent.Text = ""
cmbGender.Text = ""
cmbYearLevel.Text = ""
End Sub
Private Sub btnReturn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReturn.Click
'Returns the user to the menu page
frmMenu.Show()
Me.Hide()
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
'Clears the participants lable when data will be retrived to.
lblParticpants.Text = ""
End Sub
Private Sub cmbEventList_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbEventList.SelectedIndexChanged
'Takes ----- out of list and displays it in a lable.
If Participants.Contains("Freestyle") Then
End If
End Sub
End Class
當我選擇cmbEventList內我需要的程序通過列表來搜索並顯示包含該規定的輸入的數據(在代碼中例如我已經指出,如果它包含「自由式」)的特定項
如果問題得到解決,標誌着答案被接受,如果不是,所以說這樣我們可以回答你根據問題,如果你管理自己得到解決方案也是這樣說的;) –