contoh kode memasukkan data dari textbox kedalam listView pada vb net

  Dim harga, TotalHarga, DisRp As Double
            Dim DisPersen As Integer
            If txtKode_Brg.Text = "" Or TxtQty.Text = "" Then
                MsgBox("Masukan data pembelian", MsgBoxStyle.Exclamation, "")
                Exit Sub
            End If
            If TxtDiskonPersen.Text = "" Then
                DisPersen = 0
            Else
                DisPersen = TxtDiskonPersen.Text
            End If
            If TxtDiskonRp.Text = "" Then
                DisRp = FormatCurrency(0)
            Else
                DisRp = TxtDiskonRp.Text
            End If
            Dim lSingleItem As ListViewItem
            lSingleItem = LstTransaksi.Items.Add(txtKode_Brg.Text.Trim)  'Create a new line, and assign the ListItem into the variable so we can add sub items
            lSingleItem.SubItems.Add(TxtDeskripsi.Text.Trim) 'The first sub item for the first line
            lSingleItem.SubItems.Add(TxtQty.Text.Trim)  'The second sub item for the first line
            lSingleItem.SubItems.Add(FormatCurrency(txtHarga.Text))
            lSingleItem.SubItems.Add(DisPersen)
            lSingleItem.SubItems.Add(FormatCurrency(DisRp))
            lSingleItem.SubItems.Add(FormatCurrency(TxtHargaBarang.Text))
            If txtTotalHarga.Text = "" Then
                TotalHarga = 0
            Else
                TotalHarga = txtTotalHarga.Text
            End If

            harga = TxtHargaBarang.Text
            TotalHarga = TotalHarga + harga
            txtTotalHarga.Text = FormatCurrency(TotalHarga)
            ClearBrg()
        Catch When Err.Number <> 0
            MsgBox("Program error" _
                & vbCrLf & Err.Description)
            MyConnection.close()
        End Try
Comments
0 Comments

0 komentar:

Posting Komentar

Apabila ada Pertanyaan maka silakan tanggalkan komentar anda..
hal-hal yang melanggar hukum menjadi tanggung jawab komentator.