我想从总文本框中删除当前行文本的行和值

时间:2016-04-16 19:10:45

标签: vb.net

 Try
        Me.StockTableAdapter.FillBy(Me.PosDbDataSet.Stock, BarcodeTextBox.Text)
    Catch ex As System.Exception
        System.Windows.Forms.MessageBox.Show(ex.Message)
    End Try
    ltotal.Text = Val(ItemPriceTextBox.Text) * Val(QuantityTextBox.Text)

    Me.DataGridView1.Rows.Add(ItemNameTextBox.Text, ItemPriceTextBox.Text, QuantityTextBox.Text, ltotal.Text)
 Dim i As Integer
    Dim total As Decimal
    For i = 0 To DataGridView1.Rows.Count - 1
        total = Val(TbxToAmount.Text) + Val(DataGridView1.Item("column4", i).Value) ' or you can use Cint
    Next
    TbxToAmount.Text = total


    BarcodeTextBox.Text = ""
    ItemNameTextBox.Text = ""
    ItemPriceTextBox.Text = ""
    QuantityTextBox.Text = ""
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    If DataGridView1.SelectedRows.Count > 0 Then
        Dim ta As New DataTable
        For i As Integer = DataGridView1.SelectedRows.Count - 1 To 0 Step -1
            DataGridView1.Rows.RemoveAt(DataGridView1.SelectedRows(i).Index)

        Next
    Else
        MsgBox("No Order Items are Selected")
    End If
End Sub

0 个答案:

没有答案