تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
اظهار 3 ارقام بعد العلامة العشرية
#1
المطلوب اظهار 3 أرقام بعد العلامة العشرية
بمعنى ضرب رقمين
10*0.220=2.200
فى الداتا جريد فجول دوت نت
الرد }}}
تم الشكر بواسطة:
#2
[ تمّ الحل ] : إظهار التاريخ من اليمين إلى اليسار على الداتا جريد فيو

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 
الرد }}}
تم الشكر بواسطة: حريف برمجة , 3booody
#3
كود :
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 أرقام


الملفات المرفقة صورة/صور
   
الرد }}}
تم الشكر بواسطة: حريف برمجة , 3booody , 3booody
#4
PHP كود :
Txt_Form_Name.Text Format(10.2"0.000"
الرد }}}
تم الشكر بواسطة: حريف برمجة , 3booody , ahmedramzyaish
#5
هل يمكن التطبيق على الداتا جريد وكيفية نعديل الكود التالى
كود :
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
وشكراااا
الرد }}}
تم الشكر بواسطة:
#6
PHP كود :
Txt_Form_Name.Text Format(totsale"0.000"
الرد }}}
تم الشكر بواسطة: 3booody
#7
هذا مثال عن تنسيق التكست بوكس و الداتاغريد فيو :

   

   


الملفات المرفقة
.zip   FormatNum.zip (الحجم : 134.45 ك ب / التحميلات : 25)
الرد }}}
تم الشكر بواسطة: ahmedramzyaish
#8
(26-11-19, 04:51 PM)asemshahen5 كتب : هذا مثال عن تنسيق التكست بوكس و الداتاغريد فيو :

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


الملفات المرفقة
.rar   FormatNum.rar (الحجم : 208.16 ك ب / التحميلات : 28)
الرد }}}
تم الشكر بواسطة:
#9
اختصارا لكل الاكواد دى
خلى حقل الرقم decimal
هى افتراضى decimal(18, 0)
هتخليه decimal(18, 3)
الرد }}}
تم الشكر بواسطة: asemshahen5 , ahmedramzyaish



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


يقوم بقرائة الموضوع: