outhai1992 โพสต์ 2020-9-21 17:49:54

รบกวนสอบถามครับว่าถ้าต้องกานให้ได้ ในรูปแบบนี้ต้องทำอย่างไร

แก้ไขครั้งสุดท้ายโดย outhai1992 เมื่อ 2020-9-21 17:52

For i As Integer = 0 To DGV3.Rows.Count() - 1
            Dim AMT As String
            AMT = DGV3.Rows(i).Cells(0).Value
            If AMT <> "" Then
                DGV3.CurrentCell = DGV3.Rows(i).Cells(2)
                DGV3.BeginEdit(True)
                DGV3.CurrentRow.Cells(2).Value = Me.DGV1.CurrentRow.Cells(0).Value
            End If
      Next

      For i As Integer = 0 To DGV3.Rows.Count() - 1
            Dim AMT As String
            AMT = DGV3.Rows(i).Cells(1).Value
            If AMT <> "" Then
                DGV3.CurrentCell = DGV3.Rows(i).Cells(3)
                DGV3.BeginEdit(True)
                DGV3.CurrentRow.Cells(3).Value = Me.DGV2.CurrentRow.Cells(0).Value
            End If
      Next

thongkorn โพสต์ 2020-9-21 19:32:35

ใช้การนับจำนวนหลักของ DGV2 เพื่อนำไปใส่ใน DGV3 ที่มีหลักคงที่ แต่แถวเปลี่ยนแปลงครับ ...
      With DGV2
            .Rows(0).Cells(0).Value = "5,000"
            .Rows(0).Cells(1).Value = "2,500"
            .Rows(0).Cells(2).Value = "2,500"
            .Rows(0).Cells(3).Value = "5,000"
      End With
      For i = 0 To 5
            DGV3.Rows.Add(New String() {0, 0, 0, 0})
      Next
      For i As Byte = 0 To DGV2.ColumnCount - 1
            With DGV3
                .Rows(i + 2).Cells(3).Value = DGV2.Rows(0).Cells(i).Value
            End With
      Next

outhai1992 โพสต์ 2020-9-22 10:50:55

thongkorn ตอบกลับเมื่อ 2020-9-21 19:32
ใช้การนับจำนวนหลักของ DGV2 เพื่อนำไปใส่ใน DGV3 ที่มีหลักคงที่ แต่แถวเปลี่ยนแปลงครับ ...

ขอบพระคุณมากๆครับ
หน้า: [1]
ดูในรูปแบบกติ: รบกวนสอบถามครับว่าถ้าต้องกานให้ได้ ในรูปแบบนี้ต้องทำอย่างไร