Sub Button2Click(sender As Object, e As EventArgs) 'For i = 1 To 5 If textBox15_08_St.Text = "" Then MessageBox.Show("Bitte die Anzahl eintragen!","Info",MessageBoxButtons.OK,MessageBoxIcon.Information)退出子
结束如果
If dataGridView15_08.SelectedRows.Count = 0 And dataGridView15_08.SelectedCells.Count = 0 Then
MessageBox.Show("Bitte eine Zeile auswählen","Info",MessageBoxButtons.OK,MessageBoxIcon.Information)
Exit Sub
End If
If dataGridView15_08.SelectedRows.Count > 1 Then
MessageBox.Show("Bitte nur 1 Zeile auswählen!","Info",MessageBoxButtons.OK,MessageBoxIcon.Exclamation)
Exit Sub
End If
If dataGridView15_08.Rows.Count = 0 Then
MessageBox.Show("Bitte Filter überprüfen!","Info",MessageBoxButtons.OK,MessageBoxIcon.Information)
Exit Sub
End If
将 i 调暗为整数 = 1
对于每个 c 作为 CheckBox 在 panelCheckBox.Controls
Dim BoxName As String = "checkBox15_08_" & Str(i) Dim CheckName As String = "checkBox15_08_" & Str(i)
BoxName = BoxName.Replace(" ", "")
If c.Name = BoxName Then
If c.Checked = False Then
c.Checked = True
CType(Me.panelCheckBox.Controls(CheckName.Replace(" ","")), CheckBox).Enabled = True
CType(Me.panelTextbox.Controls(BoxName.Replace("checkBox15_08","Hersteller15")), TextBox).Text = Convert.ToString(dataGridView15_08.Rows(dataGridView15_08.CurrentRow.Index).Cells(1).Value)
CType(Me.panelTextbox.Controls(BoxName.Replace("checkBox15_08","Artikel15")), TextBox).Text = Convert.ToString(dataGridView15_08.Rows(dataGridView15_08.CurrentRow.Index).Cells(3).Value)
CType(Me.panelTextbox.Controls(BoxName.Replace("checkBox15_08","Artikel_St_15")), TextBox).Text = Me.textBox15_08_St.Text
textBox15_08_St.Text = ""
Exit For
Else
If CType(Me.panelTextbox.Controls(BoxName.Replace("checkBox15_08","Hersteller15")), TextBox).Text = Convert.ToString(dataGridView15_08.Rows(dataGridView15_08.CurrentRow.Index).Cells(1).Value) _
And CType(Me.panelTextbox.Controls(BoxName.Replace("checkBox15_08","Artikel15")), TextBox).Text = Convert.ToString(dataGridView15_08.Rows(dataGridView15_08.CurrentRow.Index).Cells(3).Value) Then
MessageBox.Show("Dieser Artikel wurde bereits hinzugefügt","Info",MessageBoxButtons.OK,MessageBoxIcon.Information)
Exit For
End If
End If
End If
i = i+1
If i = 31 Then
MessageBox.Show("Die maximale Anzahl wurde erreicht" & vbCrLf & "Bitte setze Dich mit dem Programierer in Verbindung" & vbCrLf & "Um ein Update Erweiterung zu planen","Info",MessageBoxButtons.OK,MessageBoxIcon.Error)
Exit For
End If
下一个
'End For End Sub
Sub checkBox15_08_1Click(sender As Object, e As EventArgs) 处理 checkBox15_08_1.Click checkBox15_08_1.Checked = Me.getControl(1) End Sub
Sub checkBox15_08_2Click(sender As Object, e As EventArgs) Handles checkBox15_08_2.Click checkBox15_08_2.Checked = Me.getControl(2) End Sub
Sub checkBox15_08_3Click(sender As Object, e As EventArgs) Handles checkBox15_08_3.Click checkBox15_08_3.Checked = Me.getControl(3) End Sub
Sub checkBox15_08_4Click(sender As Object, e As EventArgs) Handles checkBox15_08_4.Click checkBox15_08_4.Checked = Me.getControl(4) End Sub
Sub checkBox15_08_5Click(sender As Object, e As EventArgs) Handles checkBox15_08_5.Click checkBox15_08_5.Checked = Me.getControl(5) End Sub
Sub checkBox15_08_6Click(sender As Object, e As EventArgs) Handles checkBox15_08_6.Click checkBox15_08_6.Checked = Me.getControl(6) End Sub
Sub checkBox15_08_7Click(sender As Object, e As EventArgs) Handles checkBox15_08_7.Click checkBox15_08_7.Checked = Me.getControl(7) End Sub
Sub checkBox15_08_8Click(sender As Object, e As EventArgs) Handles checkBox15_08_8.Click checkBox15_08_8.Checked = Me.getControl(8) End Sub
Sub checkBox15_08_9Click(sender As Object, e As EventArgs) Handles checkBox15_08_9.Click checkBox15_08_9.Checked = Me.getControl(9) End Sub
Sub checkBox15_08_10Click(sender As Object, e As EventArgs) Handles checkBox15_08_10.Click checkBox15_08_10.Checked = Me.getControl(10) End Sub
Sub checkBox15_08_11Click(sender As Object, e As EventArgs) Handles checkBox15_08_11.Click checkBox15_08_11.Checked = Me.getControl(11) End Sub
Sub checkBox15_08_12Click(sender As Object, e As EventArgs) 处理 checkBox15_08_12.Click checkBox15_08_12.Checked = Me.getControl(12) End Sub
Sub checkBox15_08_13Click(sender As Object, e As EventArgs) 处理 checkBox15_08_13.Click checkBox15_08_13.Checked = Me.getControl(13) End Sub
Sub checkBox15_08_14Click(sender As Object, e As EventArgs) Handles checkBox15_08_14.Click checkBox15_08_14.Checked = Me.getControl(14) End Sub
Sub checkBox15_08_15Click(sender As Object, e As EventArgs) 处理 checkBox15_08_15.Click checkBox15_08_15.Checked = Me.getControl(15) End Sub
Sub checkBox15_08_16Click(sender As Object, e As EventArgs) 处理 checkBox15_08_16.Click checkBox15_08_16.Checked = Me.getControl(16) End Sub
Sub checkBox15_08_17Click(sender As Object, e As EventArgs) Handles checkBox15_08_17.Click checkBox15_08_17.Checked = Me.getControl(17) End Sub
Sub checkBox15_08_18Click(sender As Object, e As EventArgs) Handles checkBox15_08_18.Click checkBox15_08_18.Checked = Me.getControl(18) End Sub
Sub checkBox15_08_19Click(sender As Object, e As EventArgs) Handles checkBox15_08_19.Click checkBox15_08_19.Checked = Me.getControl(19) End Sub
Sub checkBox15_08_20Click(sender As Object, e As EventArgs) Handles checkBox15_08_20.Click checkBox15_08_20.Checked = Me.getControl(20) End Sub
Sub checkBox15_08_21Click(sender As Object, e As EventArgs) Handles checkBox15_08_21.Click checkBox15_08_21.Checked = Me.getControl(21) End Sub
Sub checkBox15_08_22Click(sender As Object, e As EventArgs) Handles checkBox15_08_22.Click checkBox15_08_22.Checked = Me.getControl(22) End Sub
Sub checkBox15_08_23Click(sender As Object, e As EventArgs) 处理 checkBox15_08_23.Click checkBox15_08_23.Checked = Me.getControl(23) End Sub Sub checkBox15_08_24Click(sender As Object, e As EventArgs) 处理 checkBox15_08_24.Click checkBox15_08_24.Checked = Me.getControl( 24) 结束子
Sub checkBox15_08_25Click(sender As Object, e As EventArgs) Handles checkBox15_08_25.Click checkBox15_08_25.Checked = Me.getControl(24) End Sub
Sub checkBox15_08_26Click(sender As Object, e As EventArgs) 处理 checkBox15_08_26.Click checkBox15_08_26.Checked = Me.getControl(26) End Sub Sub checkBox15_08_27Click(sender As Object, e As EventArgs) 处理 checkBox15_08_27.Click checkBox15_08_27.Checked = Me.getControl( 27) 结束子
Sub checkBox15_08_28Click(sender As Object, e As EventArgs) Handles checkBox15_08_28.Click checkBox15_08_28.Checked = Me.getControl(28) End Sub
Sub checkBox15_08_29Click(sender As Object, e As EventArgs) Handles checkBox15_08_29.Click checkBox15_08_29.Checked = Me.getControl(29) End Sub
Sub checkBox15_08_30Click(sender As Object, e As EventArgs) Handles checkBox15_08_30.Click checkBox15_08_30.Checked = Me.getControl(30) End Sub
函数 getControl(ByVal controlName As Integer) As Boolean
Dim txt_Name1 As String = "Hersteller15_" & Str(controlName)
Dim txt_Name2 As String = "Artikel15_" & Str(controlName)
Dim txt_Name3 As String = "Artikel_St_15_" & Str(controlName)
Dim CheckName As String = "checkBox15_08_" & Str(controlName)
If CType(Me.panelCheckBox.Controls(CheckName.Replace(" ","")), CheckBox).Enabled = True Then
CType(Me.panelCheckBox.Controls(CheckName.Replace(" ","")), CheckBox).Enabled = False
MessageBox.Show(txt_Name1)
CType(Me.panelTextbox.Controls(txt_Name1.Replace(" ", "")), TextBox).Text = ""
CType(Me.panelTextbox.Controls(txt_Name2.Replace(" ", "")), TextBox).Text = ""
CType(Me.panelTextbox.Controls(txt_Name3.Replace(" ", "")), TextBox).Text = ""
End If
返回假
结束功能
'如果没有命令 Replace(" ", "")) 就不能工作 '那必须调整!'Me.Controls(txt_Name1.Replace(" ", "")), TextBox).Text = "whatever" 'Me.panelCheckBox.Controls(txt_Name1.Replace(" ", "")), TextBox).Text = "不管什么”'Me.GroupBox1.Controls(txt_Name1.Replace(" ", "")), TextBox).Text = "whatever"