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 > พี่ๆค่ะรบกวนอธบายโค๊ดนี้ให้หน่อยได้ไหมค่ะ...ต้องการคนช่วยอธิบายด่วนๆค่ะ



 

พี่ๆค่ะรบกวนอธบายโค๊ดนี้ให้หน่อยได้ไหมค่ะ...ต้องการคนช่วยอธิบายด่วนๆค่ะ

 



Topic : 062322

Guest




พี่ๆค่ะรบกวนอธบายโค๊ดนี้ให้หน่อยได้ไหมค่ะ...เพราะได้ระบบมาตอนนี้มานั่งแกะโค๊ด รบกวนช่วยดูและอธิบายให้ทีค่ะ

ขอบคุณค่ะ



นี่โค๊ดมาจากฟอร์มการขายนะค่ะ

Private Sub number_goods_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles number_goods.ValueChanged
If cost_goods.Text <> "" Then
If number_goods.Value <= NumGood.Text Then
Total.Text = String.Format("{0:#,###.00}", number_goods.Value * Convert.ToDecimal(cost_goods.Text))

Else
MessageBox.Show("จำนวนสินค้ามีไม่เพียงพอต่อความต้องการโปรดตรวจสอบ", "ข้อความ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End If
End If
End Sub




Private Sub CalculatePriceInGrid()
Dim Sum As Decimal = 0.0
For i = 0 To gridData.RowCount - 1
gridData(7, i).Value = String.Format("{0:#,###.00}", Convert.ToInt32(gridData(4, i).Value) * Convert.ToDecimal(gridData(6, i).Value))
gridData(1, i).Value = i + 1
Sum = Sum + gridData(7, i).Value
Next
total_order.Text = String.Format("{0:#,###.00}", Sum)
End Sub


Private Sub SetLoadData()
Td_saleTableAdapter.FillSaleID(Myset.td_sale, SaleID)
Td_sale_detailTableAdapter.FillBy(Myset.td_sale_detail, SaleID)

For Each myRow In Myset.td_sale.Rows
sale_id.Text = "SAL-" & String.Format("{0:D3}", Convert.ToInt32(myRow("sale_id")))
sale_date.Value = myRow("sale_date")
note_order.Text = myRow("note_order")

Next

gridData.Rows.Clear()
For Each myRow In Myset.td_sale_detail.Rows
gridData.Rows.Add(App.My.Resources.PicDelete, gridData.RowCount + 1, String.Format("{0:D5}", myRow("code_goods")), _
myRow("name_goods"), myRow("number"), myRow("name_unit"), String.Format("{0:#,###.00}", myRow("sale_price")), _
String.Format("{0:#,###.00}", myRow("sale_total_price")))
Next
CalculatePriceInGrid()

End Sub



Private Sub BtnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDelete.Click
If SaleID <> Nothing Then
If MessageBox.Show("คุณต้องการลบเอกสารนี้จริงหรือไม่", "ข้อความ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = MsgBoxResult.Yes Then
Td_saleTableAdapter.DeleteQuery(SaleID)
ClearData()
sale_id.Text = "SAL-" & String.Format("{0:D3}", CalID)

End If
End If
End Sub



นี่มาจากฟร์อมสั่งซื้อนะค่ะ


Private Sub CalPrice()
If IsNumeric(cost_goods.Text) And num_s.Value > 0 Then
order_total_price.Text = String.Format("{0:#,###.00}", Convert.ToDecimal(cost_goods.Text) * Convert.ToDecimal(num_s.Value))

End If
End Sub


rivate Sub BtnAddList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAddList.Click
If code_goods.Text <> "" And num_s.Value <> 0 Then
gridData.Rows.Add(App.My.Resources.PicDelete, gridData.RowCount + 1, code_goods.Text, name_goods.Text, num_s.Value, String.Format("{0:#,###.00}", cost_goods.Text), _
String.Format("{0:#,###.00}", order_total_price.Text))
CalculateAllPrice()
ClearItemData()

Else
MessageBox.Show("กรุณาตรวจสอบรายละเอียดรายการก่อนการบันทึก", "ข้อความ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End If
End Sub


Private Sub CalculateAllPrice()
Dim sum As Decimal = 0
For i = 0 To gridData.Rows.Count - 1
gridData(1, i).Value = i + 1
gridData(6, i).Value = String.Format("{0:#,###.00}", Convert.ToDecimal(gridData(5, i).Value) * Convert.ToInt32(gridData(4, i).Value))
sum = sum + Convert.ToDecimal(gridData(6, i).Value)
Next
TotalAll.Text = String.Format("{0:#,###.00}", sum)

End Sub


Private Sub getOrderID()
New_Order_IDTableAdapter.Fill(Myset1.New_Order_ID)

If Myset1.New_Order_ID.Rows.Count > 0 Then
For Each myRow In Myset1.New_Order_ID.Rows
Temporder_id.Text = "OR-" + String.Format("{0:D5}", Convert.ToInt32(myRow("order_id")) + 1)
order_id.Text = Convert.ToInt32(myRow("order_id")) + 1
Next
Else
Temporder_id.Text = "OR-00001"
order_id.Text = "1"

End If
End Sub


Private Sub InsertItemData()
Try
Td_order_detailTableAdapter.DeleteQuery(order_id.Text)
For i = 0 To gridData.Rows.Count - 1
Td_order_detailTableAdapter.InsertQuery(order_id.Text, Convert.ToInt32(gridData(2, i).Value), Convert.ToInt32(gridData(4, i).Value), Convert.ToDecimal(gridData(5, i).Value), Convert.ToDecimal(gridData(6, i).Value))
Next
Catch ex As Exception

MessageBox.Show("เกิดข้อผิดพลาด" & ex.Message, "ข้อความ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End Try
End Sub


Private Sub SetOrderData(ByVal TempOrder)
order_id.Text = TempOrder
Temporder_id.Text = "OR-" + String.Format("{0:D5}", TempOrder)

Tb_orderTableAdapter.FillBy(Myset.tb_order, order_id.Text)
Td_order_detailTableAdapter.FillBy(Myset.td_order_detail, order_id.Text)

For Each myRow In Myset.tb_order.Rows
order_date.Value = Convert.ToDateTime(myRow("order_date")).ToString("s")
status_order.Text = myRow("status_order")
note_order.Text = myRow("note_order")
Next

gridData.Rows.Clear()

For Each myRow In Myset.td_order_detail.Rows
gridData.Rows.Add(App.My.Resources.PicDelete, gridData.RowCount + 1, String.Format("{0:D5}", myRow("code_goods")), myRow("name_goods"), _
Convert.ToInt32(myRow("num_s")), String.Format("{0:#,###.00}", myRow("order_price")), _
String.Format("{0:#,###.00}", myRow("order_total_price")))
Next
CalculateAllPrice()

End Sub




นี่มาจากฟอร์มรับสินค้านะค่ะ

Private Sub CalculateAllPrice()
Dim sum As Decimal = 0
For i = 0 To gridData.Rows.Count - 1
gridData(1, i).Value = i + 1
gridData(6, i).Value = String.Format("{0:#,###.00}", Convert.ToDecimal(gridData(5, i).Value) * Convert.ToInt32(gridData(4, i).Value))
sum = sum + Convert.ToDecimal(gridData(6, i).Value)
Next
TotalAll.Text = String.Format("{0:#,###.00}", sum)

End Sub



Private Sub getOrderID()
New_Recive_IDTableAdapter.Fill(Myset.New_Recive_ID)

If Myset.New_Recive_ID.Rows.Count > 0 Then
For Each myRow In Myset.New_Recive_ID.Rows
Temporder_receive_code.Text = "RE-" + String.Format("{0:D5}", Convert.ToInt32(myRow("receive_code")) + 1)
order_id.Text = Convert.ToInt32(myRow("receive_code")) + 1
Next
Else
Temporder_receive_code.Text = "RE-00001"
receive_code.Text = "1"

End If
End Sub



Private Sub SetOrderData(ByVal TempOrder)
order_id.Text = TempOrder
Temporder_id.Text = "OR-" + String.Format("{0:D5}", TempOrder)

Tb_orderTableAdapter.FillBy(Myset.tb_order, order_id.Text)
Td_order_detailTableAdapter.FillBy(Myset.td_order_detail, order_id.Text)

For Each myRow In Myset.tb_order.Rows
order_date.Value = Convert.ToDateTime(myRow("order_date")).ToString("s")
Next

gridData.Rows.Clear()

For Each myRow In Myset.td_order_detail.Rows
gridData.Rows.Add(App.My.Resources.PicDelete, gridData.RowCount + 1, String.Format("{0:D5}", myRow("code_goods")), myRow("name_goods"), _
Convert.ToInt32(myRow("num_s")), String.Format("{0:#,###.00}", myRow("order_price")), _
String.Format("{0:#,###.00}", myRow("order_total_price")))
Next
CalculateAllPrice()

End Sub



Tag : .NET, Ms SQL Server 2008, Crystal Report, VB.NET







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2011-06-26 19:30:00 By : แพรว View : 1028 Reply : 5
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

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

ทำความเข้าใจก่อนดีกว่าไหม๊ครับ แต่ล่ะตัวความหมายก็บอกอยู่แล้วน่ะครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-06-26 20:05:21 By : webmaster
 


 

No. 2

Guest


งง ตรง 0:#,###.00 อ่าค่ะมันเปนสัญลักษณ์แบบนี้ มันคือไรแทนค่าไรงิ 555



แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-06-26 20:17:19 By : แพรว
 

 

No. 3



โพสกระทู้ ( 11,835 )
บทความ ( 10 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

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


อยากรู้มันคืออะไรก็คนหา ซิครับ
String.Format("{0:#,###.00}", myRow("order_total_price")))
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-06-26 21:36:44 By : PlaKriM
 


 

No. 4



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



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


เป็นการเซทฟอร์แมท ตัวเลข อะครับ

String.Format("{0:#,###.00}", myRow("order_total_price")))
อันนี้เซทให้กับ order_total_price ครับ

เอาโค้ดมายาวมาก อธิบายไม่ไหวครับ จะให้อธิบายทีละบรรทัดเลยครับ
ผมดูแล้ว แต่ละ procedure มันก็ตั้งชื่อสื่ออยู่แล้วนะครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-06-26 22:08:46 By : nong1210
 


 

No. 5

Guest


ขอบคุณทุกคำตอบค๊าาาา....
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-06-27 12:48:27 By : แพรว
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : พี่ๆค่ะรบกวนอธบายโค๊ดนี้ให้หน่อยได้ไหมค่ะ...ต้องการคนช่วยอธิบายด่วนๆค่ะ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 อัตราราคา คลิกที่นี่