منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
اظهار 3 ارقام بعد العلامة العشرية - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم اسئلة VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=183)
+--- الموضوع : اظهار 3 ارقام بعد العلامة العشرية (/showthread.php?tid=32224)



اظهار 3 ارقام بعد العلامة العشرية - ahmedramzyaish - 23-11-19

المطلوب اظهار 3 أرقام بعد العلامة العشرية
بمعنى ضرب رقمين
10*0.220=2.200
فى الداتا جريد فجول دوت نت


RE: اظهار 3 ارقام بعد العلامة العشرية - asemshahen5 - 23-11-19

[ تمّ الحل ] : إظهار التاريخ من اليمين إلى اليسار على الداتا جريد فيو

PHP كود :
   Private Sub DGV_STUDENT_CellFormatting(sender As ObjectAs DataGridViewCellFormattingEventArgsHandles DGV_STUDENT.CellFormatting
        If e
.ColumnIndex 0 Then
            If e
.RowIndex DGV_STUDENT.Rows.Count 1 Then Exit Sub
            e
.Value CDbl(e.Value)
 
           e.CellStyle.Format "0.00"
 
       End If
 
   End Sub 



RE: اظهار 3 ارقام بعد العلامة العشرية - ahmedramzyaish - 23-11-19

كود :
Private Sub CalcTot()
        Dim totpurch As Double = 0
        Dim totsale As Double = 0

        Dim totquan As Double = 0

        Dim totpurchafterdisc As Double = 0
        Dim totsaleafterdisc As Double = 0

        Dim totdiff As Double = 0

        Dim sumtax As Double = 0
        Dim sumdiscount As Double = 0

        For i = 0 To dgvItems.Rows.Count - 1
            Dim dgvCellProc As DataGridViewComboBoxCell = CType(dgvItems.Rows(i).Cells(1), DataGridViewCell)
            If dgvCellProc.Value = "شراء" Then
                totpurch += Convert.ToDouble(dgvItems.Rows(i).Cells(8).Value)
                totpurchafterdisc += Convert.ToDouble(dgvItems.Rows(i).Cells(13).Value)
            Else
                totsale += Convert.ToDouble(dgvItems.Rows(i).Cells(8).Value)
                totsaleafterdisc += Convert.ToDouble(dgvItems.Rows(i).Cells(13).Value)
            End If

            totquan += Convert.ToDouble(dgvItems.Rows(i).Cells(4).Value)
            sumdiscount += Convert.ToDouble(dgvItems.Rows(i).Cells(11).Value)
            sumtax += Convert.ToDouble(dgvItems.Rows(i).Cells(15).Value)
        Next

        If totpurch <> 0 Then
            totdiff = totpurch - totsale
        Else
            totdiff = totsale
        End If

        txtTotQuan.Text = "" & totquan

        txtTotPurch.Text = String.Format("{0:0.#,##.##}", totpurch)
        txtTotSale.Text = String.Format("{0:0.#,##.##}", totsale)
        txtDiff.Text = String.Format("{0:0.#,##.##}", totdiff)

        txtMinusVal.Text = "" & sumdiscount

        If InvProc = 1 Then
            txtTotAfterDisc.Text = String.Format("{0:0.#,##.##}", totpurchafterdisc)
        Else
            txtTotAfterDisc.Text = String.Format("{0:0.#,##.##}", totsaleafterdisc)
        End If

        If InvProc = 1 Then
            'Dim _val As Double = Math.Round((Val(txtTax.Text) / 100) * Convert.ToDouble(txtTotPurch.Text), 2)
            Dim _val As Double = "" & sumtax
            lblTaxVal.Text = "" & _val
            txtDiff.Text = Convert.ToDouble(txtTotPurch.Text) + _val - Val(txtMinusVal.Text)
        Else
            'Dim _val As Double = Math.Round((Val(txtTax.Text) / 100) * Convert.ToDouble(txtTotSale.Text), 2)
            Dim _val As Double = "" & sumtax
            lblTaxVal.Text = "" & _val
            txtDiff.Text = Convert.ToDouble(txtTotSale.Text) + _val - Val(txtMinusVal.Text)
        End If

    End Sub

(23-11-19, 10:59 PM)ahmedramzyaish كتب :
كود :
Private Sub CalcTot()
       Dim totpurch As Double = 0
       Dim totsale As Double = 0

       Dim totquan As Double = 0

       Dim totpurchafterdisc As Double = 0
       Dim totsaleafterdisc As Double = 0

       Dim totdiff As Double = 0

       Dim sumtax As Double = 0
       Dim sumdiscount As Double = 0

       For i = 0 To dgvItems.Rows.Count - 1
           Dim dgvCellProc As DataGridViewComboBoxCell = CType(dgvItems.Rows(i).Cells(1), DataGridViewCell)
           If dgvCellProc.Value = "شراء" Then
               totpurch += Convert.ToDouble(dgvItems.Rows(i).Cells(8).Value)
               totpurchafterdisc += Convert.ToDouble(dgvItems.Rows(i).Cells(13).Value)
           Else
               totsale += Convert.ToDouble(dgvItems.Rows(i).Cells(8).Value)
               totsaleafterdisc += Convert.ToDouble(dgvItems.Rows(i).Cells(13).Value)
           End If

           totquan += Convert.ToDouble(dgvItems.Rows(i).Cells(4).Value)
           sumdiscount += Convert.ToDouble(dgvItems.Rows(i).Cells(11).Value)
           sumtax += Convert.ToDouble(dgvItems.Rows(i).Cells(15).Value)
       Next

       If totpurch <> 0 Then
           totdiff = totpurch - totsale
       Else
           totdiff = totsale
       End If

       txtTotQuan.Text = "" & totquan

       txtTotPurch.Text = String.Format("{0:0.#,##.##}", totpurch)
       txtTotSale.Text = String.Format("{0:0.#,##.##}", totsale)
       txtDiff.Text = String.Format("{0:0.#,##.##}", totdiff)

       txtMinusVal.Text = "" & sumdiscount

       If InvProc = 1 Then
           txtTotAfterDisc.Text = String.Format("{0:0.#,##.##}", totpurchafterdisc)
       Else
           txtTotAfterDisc.Text = String.Format("{0:0.#,##.##}", totsaleafterdisc)
       End If

       If InvProc = 1 Then
           'Dim _val As Double = Math.Round((Val(txtTax.Text) / 100) * Convert.ToDouble(txtTotPurch.Text), 2)
           Dim _val As Double = "" & sumtax
           lblTaxVal.Text = "" & _val
           txtDiff.Text = Convert.ToDouble(txtTotPurch.Text) + _val - Val(txtMinusVal.Text)
       Else
           'Dim _val As Double = Math.Round((Val(txtTax.Text) / 100) * Convert.ToDouble(txtTotSale.Text), 2)
           Dim _val As Double = "" & sumtax
           lblTaxVal.Text = "" & _val
           txtDiff.Text = Convert.ToDouble(txtTotSale.Text) + _val - Val(txtMinusVal.Text)
       End If

   End Sub

المطلوب اظهار القيم فى اجمالى المستند بعد العلامة العشرية 3 أرقام


RE: اظهار 3 ارقام بعد العلامة العشرية - asemshahen5 - 24-11-19

PHP كود :
Txt_Form_Name.Text Format(10.2"0.000"



RE: اظهار 3 ارقام بعد العلامة العشرية - ahmedramzyaish - 26-11-19

هل يمكن التطبيق على الداتا جريد وكيفية نعديل الكود التالى
كود :
dgvItems.Rows(_rowinx).Cells(7).Value = String.Format("{0:0.#,##.##}", Convert.ToDouble(dt1.Rows(0)("sale_price")))
كما تعديل الكود التالى ايضا
كود :
txtTotSale.Text = String.Format("{0:0.#,##.##}", totsale)
لانى عندما عدلت كما موضح باشرح لم ينجح معى
مع العلم انه المطلوب اظهار الرقم 2.200 وليس 2.2 او 2.20
للتعامل مع الدينار الكويتى
اى رقم يظهر يجب ان يكون بعد العلامة يكون 3 ارقام دائما
حتى ولو 1.1 يكون 1.100
وشكراااا


RE: اظهار 3 ارقام بعد العلامة العشرية - asemshahen5 - 26-11-19

PHP كود :
Txt_Form_Name.Text Format(totsale"0.000"



RE: اظهار 3 ارقام بعد العلامة العشرية - asemshahen5 - 26-11-19

هذا مثال عن تنسيق التكست بوكس و الداتاغريد فيو :

[attachment=23547]

[attachment=23548]


RE: اظهار 3 ارقام بعد العلامة العشرية - ahmedramzyaish - 26-11-19

(26-11-19, 04:51 PM)asemshahen5 كتب : هذا مثال عن تنسيق التكست بوكس و الداتاغريد فيو :

الكود على فورم 2


RE: اظهار 3 ارقام بعد العلامة العشرية - mero5000 - 27-11-19

اختصارا لكل الاكواد دى
خلى حقل الرقم decimal
هى افتراضى decimal(18, 0)
هتخليه decimal(18, 3)