Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > .NET Framework > Forum > PrintDialog ให้ข้อมูลใน datagridview มีทศนิยม .00 กำหนดเป็น "N2" แล้วแต่ก็ได้ค่าเป็นจำนวนเต็มอยู่ครับ



 

PrintDialog ให้ข้อมูลใน datagridview มีทศนิยม .00 กำหนดเป็น "N2" แล้วแต่ก็ได้ค่าเป็นจำนวนเต็มอยู่ครับ

 



Topic : 133531



โพสกระทู้ ( 14 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook



ผมต้องการให้มันแสดงเป็น .00 ครับ
1
ผมกำหนดค่าเป็น N2 แล้วแต่ทำไมมันยังแสดงเป็นจำนวนเต็มอยู่อ่ะครับ
2
3



Tag : .NET, Ms Access, VB.NET







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2019-04-26 16:38:11 By : 2535466999857732 View : 1331 Reply : 10
 

 

No. 1



โพสกระทู้ ( 4,436 )
บทความ ( 23 )



สถานะออฟไลน์
Facebook

.ToString("0.00")

"N2" ไม่ได้เกี่ยวกับ report แค่ displayใน datagrid






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-04-26 19:55:57 By : lamaka.tor
 


 

No. 2



โพสกระทู้ ( 14 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

มันแสดงแค่ 6 อ่ะครับ
4
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-04-26 20:11:11 By : 2535466999857732
 

 

No. 3



โพสกระทู้ ( 4,436 )
บทความ ( 23 )



สถานะออฟไลน์
Facebook

แล้วได้ทำตามที่บอกไปยังครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-04-26 20:51:12 By : lamaka.tor
 


 

No. 4



โพสกระทู้ ( 14 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

ทำแล้วครับผม
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-04-26 21:27:44 By : 2535466999857732
 


 

No. 5



โพสกระทู้ ( 4,436 )
บทความ ( 23 )



สถานะออฟไลน์
Facebook

ขอดูโค้ดล่าสุดหน่อยคร้าบ เขียนไปยังไงแล้วมั่ง
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-04-26 21:32:34 By : lamaka.tor
 


 

No. 6



โพสกระทู้ ( 14 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

Code (VB.NET)
Dim font1 As New Font("Angsana New", 19)
        Dim font2 As New Font("Angsana New", 38)

        Dim head As String = "ใบเสร็จรับเงิน"
        Dim js As String = "ร้าน เจริญค้า"
        Dim add As String = "198/8 ม.7 ต.อ่างทอง อ.เมือง จ.ราชบุรี 70000"
        Dim order As String = "เลขที่ : "
        Dim cusname As String = "ชื่อลูกค้า:"
        Dim datess As String = "วันที่ : "
        Dim typecus As String = Tb_cname.Text
        Dim x As String = Tb_order.Text
        Dim daytime As Date = Date.Today
        Dim line As String = "______________________________________________________________________________________"
        Dim deta As String = "                  สินค้า                                    จำนวน              หน่วย                     ราคา                        รวมเงิน"
        Dim tot As String = "รวมเงินทั้งสิ้น : "
        Dim sum As String = Tb_total.Text
        Dim bath As String = "บาท"
        Dim c1 As String = "ผู้รับของ:__________________"
        Dim c2 As String = "ผู้รับเงิน:__________________"

        e.Graphics.DrawString(js.ToString, font1, Brushes.Black, 50, 75)  
        e.Graphics.DrawString(head.ToString, font2, Brushes.Black, 300, 15)
        e.Graphics.DrawString(add.ToString, font1, Brushes.Black, 50, 105)

        e.Graphics.DrawString(order.ToString, font1, Brushes.Black, 50, 135)
        e.Graphics.DrawString(x.ToString, font1, Brushes.Black, 110, 135)
        e.Graphics.DrawString(datess.ToString, font1, Brushes.Black, 50, 165)
        e.Graphics.DrawString(daytime.Date, font1, Brushes.Black, 100, 165)
        e.Graphics.DrawString(cusname.ToString, font1, Brushes.Black, 50, 195)
        e.Graphics.DrawString(typecus.ToString, font1, Brushes.Black, 120, 195)
        

        e.Graphics.DrawString(line.ToString, font1, Brushes.Black, 30, 200) 'เส้นคั่น
        e.Graphics.DrawString(deta.ToString, font1, Brushes.Black, 30, 230)
        e.Graphics.DrawString(line.ToString, font1, Brushes.Black, 30, 240) 'เส้นคั่น

        Dim PrintPosition As New PointF
        Dim PrintColor As New SolidBrush(Color.Black)
        Dim col As Integer = 50 'ยาว
        Dim row As Integer = 280 'บรรทัด
        Dim col1 As Integer = 340
        Dim row1 As Integer = 280
        Dim col2 As Integer = 440
        Dim row2 As Integer = 280
        Dim col3 As Integer = 640
        Dim row3 As Integer = 300
        Dim col4 As Integer = 790
        Dim row4 As Integer = 300


        For z = 0 To DataGridView3.Rows.Count - 2
            PrintPosition = New PointF(col, row)
            e.Graphics.DrawString(DataGridView3.Rows(z).Cells(2).Value.ToString, font1, PrintColor, PrintPosition)
            row = row + 30
        Next

        For z = 0 To DataGridView3.Rows.Count - 2
            PrintPosition = New PointF(col1, row1)
            e.Graphics.DrawString(DataGridView3.Rows(z).Cells(5).Value.ToString, font1, PrintColor, PrintPosition)
            row1 = row1 + 30
        Next

        For z = 0 To DataGridView3.Rows.Count - 2
            PrintPosition = New PointF(col2, row2)
            e.Graphics.DrawString(DataGridView3.Rows(z).Cells(3).Value.ToString, font1, PrintColor, PrintPosition)
            row2 = row2 + 30
        Next

        Dim format1 As New StringFormat(StringFormatFlags.NoClip)
        Dim format2 As New StringFormat(format1)

        format1.LineAlignment = StringAlignment.Near
        format1.Alignment = StringAlignment.Center
        format2.LineAlignment = StringAlignment.Center
        format2.Alignment = StringAlignment.Far

        For z = 0 To DataGridView3.Rows.Count - 2
            PrintPosition = New PointF(col3, row3)
            e.Graphics.DrawString(DataGridView3.Rows(z).Cells(4).Value.ToString, font1, PrintColor, PrintPosition, format2)
            row3 = row3 + 30
        Next

        For z = 0 To DataGridView3.Rows.Count - 2
            PrintPosition = New PointF(col4, row4)
            e.Graphics.DrawString(DataGridView3.Rows(z).Cells(6).Value.ToString, font1, PrintColor, PrintPosition, format2)
            row4 = row4 + 30
        Next

       
        e.Graphics.DrawString(line.ToString, font1, Brushes.Black, 30, 950) 'เส้นคั่น 

        e.Graphics.DrawString(tot.ToString, font1, Brushes.Black, 520, 1000)
        e.Graphics.DrawString(sum.ToString, font1, Brushes.Black, 640, 1000)
        e.Graphics.DrawString(bath.ToString, font1, Brushes.Black, 750, 1000)

        e.Graphics.DrawString(c1.ToString, font1, Brushes.Black, 80, 1050)
        e.Graphics.DrawString(c2.ToString, font1, Brushes.Black, 85, 1110)

    End Sub

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-04-26 21:58:02 By : 2535466999857732
 


 

No. 7



โพสกระทู้ ( 14 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

ช่วยหน่อยค้าบ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-04-30 01:17:18 By : 2535466999857732
 


 

No. 8



โพสกระทู้ ( 9,559 )
บทความ ( 2 )



สถานะออฟไลน์


กลับไปอ่านความเห็น 1 ทำตรงไหนทีบอกทำแล้ว
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-04-30 05:46:30 By : Chaidhanan
 


 

No. 9



โพสกระทู้ ( 4,436 )
บทความ ( 23 )



สถานะออฟไลน์
Facebook

ตามที่ท่าน Chaidhanan บอกเลยครับ
ถ้าไม่ได้ แสดงว่า ไม่ได้ทำ คร้าบ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-04-30 08:17:13 By : lamaka.tor
 


 

No. 10



โพสกระทู้ ( 14 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

ผมทำตามไปแล้วครับมันไม่แสดง 650.00 แต่ แสดง 6 แทนครับ

Code (VB.NET)
Dim font1 As New Font("Angsana New", 19)
        Dim font2 As New Font("Angsana New", 38)

        Dim head As String = "ใบเสร็จรับเงิน"
        Dim js As String = "ร้าน เจริญค้า"
        Dim add As String = "198/8 ม.7 ต.อ่างทอง อ.เมือง จ.ราชบุรี 70000"
        Dim order As String = "เลขที่ : "
        Dim cusname As String = "ชื่อลูกค้า:"
        Dim datess As String = "วันที่ : "
        Dim typecus As String = Tb_cname.Text
        Dim x As String = Tb_order.Text
        Dim daytime As Date = Date.Today
        Dim line As String = "______________________________________________________________________________________"
        Dim deta As String = "                  สินค้า                                    จำนวน              หน่วย                     ราคา                        รวมเงิน"
        Dim tot As String = "รวมเงินทั้งสิ้น : "
        Dim sum As String = Tb_total.Text
        Dim bath As String = "บาท"
        Dim c1 As String = "ผู้รับของ:__________________"
        Dim c2 As String = "ผู้รับเงิน:__________________"

        e.Graphics.DrawString(js.ToString, font1, Brushes.Black, 50, 75)  
        e.Graphics.DrawString(head.ToString, font2, Brushes.Black, 300, 15)
        e.Graphics.DrawString(add.ToString, font1, Brushes.Black, 50, 105)

        e.Graphics.DrawString(order.ToString, font1, Brushes.Black, 50, 135)
        e.Graphics.DrawString(x.ToString, font1, Brushes.Black, 110, 135)
        e.Graphics.DrawString(datess.ToString, font1, Brushes.Black, 50, 165)
        e.Graphics.DrawString(daytime.Date, font1, Brushes.Black, 100, 165)
        e.Graphics.DrawString(cusname.ToString, font1, Brushes.Black, 50, 195)
        e.Graphics.DrawString(typecus.ToString, font1, Brushes.Black, 120, 195)
        

        e.Graphics.DrawString(line.ToString, font1, Brushes.Black, 30, 200) 'เส้นคั่น
        e.Graphics.DrawString(deta.ToString, font1, Brushes.Black, 30, 230)
        e.Graphics.DrawString(line.ToString, font1, Brushes.Black, 30, 240) 'เส้นคั่น

        Dim PrintPosition As New PointF
        Dim PrintColor As New SolidBrush(Color.Black)
        Dim col As Integer = 50 'ยาว
        Dim row As Integer = 280 'บรรทัด
        Dim col1 As Integer = 340
        Dim row1 As Integer = 280
        Dim col2 As Integer = 440
        Dim row2 As Integer = 280
        Dim col3 As Integer = 640
        Dim row3 As Integer = 300
        Dim col4 As Integer = 790
        Dim row4 As Integer = 300


        For z = 0 To DataGridView3.Rows.Count - 2
            PrintPosition = New PointF(col, row)
            e.Graphics.DrawString(DataGridView3.Rows(z).Cells(2).Value.ToString, font1, PrintColor, PrintPosition)
            row = row + 30
        Next

        For z = 0 To DataGridView3.Rows.Count - 2
            PrintPosition = New PointF(col1, row1)
            e.Graphics.DrawString(DataGridView3.Rows(z).Cells(5).Value.ToString, font1, PrintColor, PrintPosition)
            row1 = row1 + 30
        Next

        For z = 0 To DataGridView3.Rows.Count - 2
            PrintPosition = New PointF(col2, row2)
            e.Graphics.DrawString(DataGridView3.Rows(z).Cells(3).Value.ToString, font1, PrintColor, PrintPosition)
            row2 = row2 + 30
        Next

        Dim format1 As New StringFormat(StringFormatFlags.NoClip)
        Dim format2 As New StringFormat(format1)

        format1.LineAlignment = StringAlignment.Near
        format1.Alignment = StringAlignment.Center
        format2.LineAlignment = StringAlignment.Center
        format2.Alignment = StringAlignment.Far

        For z = 0 To DataGridView3.Rows.Count - 2
            PrintPosition = New PointF(col3, row3)
            e.Graphics.DrawString(DataGridView3.Rows(z).Cells(4).Value.ToString, font1, PrintColor, PrintPosition, format2)
            row3 = row3 + 30
        Next

        For z = 0 To DataGridView3.Rows.Count - 2
            PrintPosition = New PointF(col4, row4)
           e.Graphics.DrawString(DataGridView3.Rows(z).Cells(6).Value.ToString("0.00"), font1, PrintColor, PrintPosition, format2)
            row4 = row4 + 30
        Next

       
        e.Graphics.DrawString(line.ToString, font1, Brushes.Black, 30, 950) 'เส้นคั่น 

        e.Graphics.DrawString(tot.ToString, font1, Brushes.Black, 520, 1000)
        e.Graphics.DrawString(sum.ToString, font1, Brushes.Black, 640, 1000)
        e.Graphics.DrawString(bath.ToString, font1, Brushes.Black, 750, 1000)

        e.Graphics.DrawString(c1.ToString, font1, Brushes.Black, 80, 1050)
        e.Graphics.DrawString(c2.ToString, font1, Brushes.Black, 85, 1110)

    End Sub



ประวัติการแก้ไข
2019-05-01 00:45:26
2019-05-01 00:46:16
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2019-05-01 00:34:37 By : 2535466999857732
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : PrintDialog ให้ข้อมูลใน datagridview มีทศนิยม .00 กำหนดเป็น "N2" แล้วแต่ก็ได้ค่าเป็นจำนวนเต็มอยู่ครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่