我在这里要做的是,对于添加到 中的每个新项目ComboBox
,标签的文本属性将显示前一个数字的 +1。
假设我没有为项目分配编号,我该如何写出来。
Items Label
Tom 1
Jane 2
Mary 3
John 4
etc.. etc..
编辑:我ComboBox
的绑定到数据源。
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Dim studentcheck = StudentTableAdapter.checkstudent(StudentNameTextBox.Text, StudentAddressTextBox.Text)
If StudentNameTextBox.Text.Length = 0 Then
MsgBox("Name is Empty")
ElseIf StudentAddressTextBox.Text.Length = 0 Then
MsgBox("Address is empty")
ElseIf studentcheck Is Nothing Then
Me.Validate()
Me.StudentBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.LibraryDataSet)
frmAddLoan.DisplayLoanTableAdapter.Fill(frmAddLoan.LibraryDataSet.DisplayLoan)
frmAddLoan.ComboBox1.Update()
MsgBox("Student Info Added")
Else
MsgBox("Student Name and Address have been used.")
End If
End Sub