تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
ايجاد قيمة المجموع العام
#7
كود :
   Private Sub Populate_Category()
       ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList
       Dim da As New OleDbDataAdapter("select CategoryName , CategoryValue From Category order by CategoryName Asc", conn)
       Dim Dt As New DataTable
       da.Fill(Dt)
       ComboBox1.DataSource = Dt
       ComboBox1.DisplayMember = "CategoryName"
       ComboBox1.ValueMember = "CategoryValue"
       ComboBox1.SelectedIndex = -1
   End Sub
كود :
   Private Sub SUMME()
       Dim SUMDATAGRIDVIEW As Decimal = 0.0
       For i As Integer = 0 To DataGridView1.Rows.Count - 1
           SUMDATAGRIDVIEW = SUMDATAGRIDVIEW + DataGridView1.Rows(i).Cells("itemPrice").Value
       Next
       TextBox4.Text = SUMDATAGRIDVIEW

       Dim SUMComboBox1 As Decimal = 0.0
       If IsNumeric(ComboBox1.SelectedValue) Then
           SUMComboBox1 = ComboBox1.SelectedValue
       End If
       TextBox5.Text = SUMComboBox1.ToString()

       Dim SUMCHECKEDCHECKBOX As Decimal = 0.0
       Dim checks() As CheckBox = {CheckBox1, CheckBox2, CheckBox3}
       SUMCHECKEDCHECKBOX = (From cb In checks Where cb.Checked Order By cb.Text Select cb.Checked).Count
       TextBox6.Text = SUMCHECKEDCHECKBOX

       Dim SUBTOTAL As Decimal = 0.0
       SUBTOTAL = SUMComboBox1 * SUMCHECKEDCHECKBOX
       TextBox7.Text = SUBTOTAL

       Dim CHARGES As Decimal = 0.0
       CHARGES = Val(TextBox8.Text)

       Dim DISCOUNT As Decimal = 0.0
       DISCOUNT = Val(TextBox9.Text)

       Dim FULLTOTAL As Decimal = 0.0
       FULLTOTAL = (SUMDATAGRIDVIEW + SUBTOTAL + CHARGES) - DISCOUNT
       TextBox10.Text = FULLTOTAL
   End Sub

اكتفي ب SUMME في ComboBox1_SelectedIndexChanged
كود :
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles ComboBox1.SelectedIndexChanged
        SUMME()
    End Sub
الرد }}}
تم الشكر بواسطة: العيدروس


الردود في هذا الموضوع
RE: ايجاد قيمة المجموع العام - بواسطة Zuhare - 06-12-24, 04:06 PM
RE: ايجاد قيمة المجموع العام - بواسطة Zuhare - 06-12-24, 09:07 PM


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم