Torna al Thread

Private Sub Button_Click(ByVal sender As Object, ByVal e As _ System.EventArgs) ListBox2.Items.Add(CType(CType(sender, _ System.Windows.Forms.Button).Text, String)) Dim stringa() As String = {"1", CType(CType(sender, System.Windows.Forms.Button).Text, String).Substring(0, 5), CType(CType(sender, System.Windows.Forms.Button).Text, String).Substring(6), "", CType(CType(sender, System.Windows.Forms.Button).Tag, String) + " €"} Dim item As New ListViewItem(stringa) ListView1.Items.Add(item) Try Dim CNT1 As Integer = 0 Dim CNT2 As Integer = 0 bottone1 = New Button(ListView1.Items.Count * 4) {} bottone2 = New ComboBox(ListView1.Items.Count) {} Dim X As Integer = ListView1.Location.X - 110 Dim Y As Integer = ListView1.Location.Y + 25 While CNT1 < ListView1.Items.Count * 4 bottone1(CNT1) = New Button bottone1(CNT1).Location = New System.Drawing.Point(X, Y) bottone1(CNT1).Size = New System.Drawing.Size(20, 20) bottone1(CNT1).TextAlign = ContentAlignment.MiddleCenter bottone1(CNT1).ForeColor = System.Drawing.Color.Black bottone1(CNT1).Text = "+" bottone1(CNT1).Tag = CNT2 AddHandler bottone1(CNT1).Click, AddressOf bottoni Me.SplitContainer1.Panel2.Controls.Add(bottone1(CNT1)) CNT1 += 1 X = X + 20 bottone1(CNT1) = New Button bottone1(CNT1).Location = New System.Drawing.Point(X, Y) bottone1(CNT1).Size = New System.Drawing.Size(20, 20) bottone1(CNT1).TextAlign = ContentAlignment.MiddleCenter bottone1(CNT1).ForeColor = System.Drawing.Color.Black bottone1(CNT1).Text = "-" bottone1(CNT1).Tag = CNT2 AddHandler bottone1(CNT1).Click, AddressOf bottoni Me.SplitContainer1.Panel2.Controls.Add(bottone1(CNT1)) CNT1 += 1 X = X + 20 bottone1(CNT1) = New Button bottone1(CNT1).Location = New System.Drawing.Point(X, Y) bottone1(CNT1).Size = New System.Drawing.Size(20, 20) bottone1(CNT1).TextAlign = ContentAlignment.MiddleCenter bottone1(CNT1).ForeColor = System.Drawing.Color.Black bottone1(CNT1).Text = "D" 'AddHandler bottone1(CNT).Click, AddressOf Button_Click X = X + 20 bottone2(CNT2) = New ComboBox bottone2(CNT2).Location = New System.Drawing.Point(X, Y) bottone2(CNT2).Size = New System.Drawing.Size(50, 20) 'bottone1(CNT1).TextAlign = ContentAlignment.MiddleCenter bottone2(CNT2).ForeColor = System.Drawing.Color.Black 'For index = 0 To bottone2(CNT2).Items.Count - 1 'If bottone2(CNT2).Items(index).ToString = CType(CType(sender, System.Windows.Forms.Button).Text, String).Substring(0, 5) Then 'bottone2(CNT2).SelectedIndex = index 'Exit For 'End If 'Next 'bottone2(CNT2).SelectedItem = CType(CType(sender, System.Windows.Forms.Button).Text, String).Substring(0, 5) bottone2(CNT2).DropDownStyle = ComboBoxStyle.DropDownList bottone2(CNT2).Items.Add(FormAggiungi.ComboBox1.Items(0).Substring(0, 5)) bottone2(CNT2).Items.Add(FormAggiungi.ComboBox1.Items(1).Substring(0, 5)) bottone2(CNT2).Items.Add(FormAggiungi.ComboBox1.Items(2).Substring(0, 5)) bottone2(CNT2).Items.Add(FormAggiungi.ComboBox1.Items(3).Substring(0, 5)) bottone2(CNT2).SelectedItem = CType(CType(sender, System.Windows.Forms.Button).Text, String).Substring(0, 5) bottone2(CNT2).Tag = CNT2 AddHandler bottone2(CNT2).SelectedValueChanged, AddressOf cambia X = X + 20 Me.SplitContainer1.Panel2.Controls.Add(bottone1(CNT1)) CNT1 += 1 Me.SplitContainer1.Panel2.Controls.Add(bottone2(CNT2)) CNT2 += 1 X = X + 25 + ListView1.Width + 5 bottone1(CNT1) = New Button bottone1(CNT1).Location = New System.Drawing.Point(X, Y) bottone1(CNT1).Size = New System.Drawing.Size(40, 20) bottone1(CNT1).TextAlign = ContentAlignment.MiddleCenter bottone1(CNT1).ForeColor = System.Drawing.Color.Black bottone1(CNT1).Text = "Ingr." AddHandler bottone1(CNT1).Click, AddressOf aggiungi Me.SplitContainer1.Panel2.Controls.Add(bottone1(CNT1)) CNT1 += 1 X = ListView1.Location.X - 110 Y = Y + 20 End While Catch ex As Exception End Try End Sub
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5