Я создаю квитанцию с помощью Printdocument
данные поступают из datagridview. условие состоит в том, что, как только длина char> 10 в datagridview col1, печатается строка col2, следующая строка col1. и продолжайте к следующей строке новые данные на col1 снова. ошибка в том, что следующие данные в столбце col1 перекрываются с данными в строке col1.
Dim I As Integer
For I = 0 To dvProducts.Rows.Count - 1
Dim yloc = (20 * I) + 90
Dim L As Integer
L = dvProducts.Rows(I).Cells(0).Value.ToString.Length
If L > 10 Then
e.Graphics.DrawString(dvProducts.Rows(I).Cells(0).Value, font2, Brushes.Black, 10, yloc)
yloc = (20 * I) + 90 + 20
e.Graphics.DrawString(dvProducts.Rows(I).Cells(1).Value, font2, Brushes.Black, 110, yloc)
e.Graphics.DrawString(Val(dvProducts.Rows(I).Cells(2).Value).ToString("N"), font2, Brushes.Black, 150, yloc)
e.Graphics.DrawString(dvProducts.Rows(I).Cells(3).Value, font2, Brushes.Black, 230, yloc, left)
'Dim dvcount As Integer = dvProducts.Rows.Count
'Dim newloc As Integer = dvcount * 20 + 100
'e.Graphics.DrawString("Total Amount:", font2, Brushes.Black, 100, newloc + 10)
'e.Graphics.DrawString(txtgt.Text, font2, Brushes.Black, 230, newloc + 10, left)
'e.Graphics.DrawString("Cash:", font2, Brushes.Black, 100, newloc + 30)
'e.Graphics.DrawString(Val(txtTender.Text).ToString("N"), font2, Brushes.Black, 230, newloc + 30, left)
'e.Graphics.DrawString("Change", font2, Brushes.Black, 100, newloc + 50)
'e.Graphics.DrawString(txtChange.Text, font2, Brushes.Black, 230, newloc + 50, left)
'e.Graphics.DrawString("Date: " & dtptdate.Text & "", font2, Brushes.Black, 10, newloc + 90)
Else
e.Graphics.DrawString(dvProducts.Rows(I).Cells(0).Value, font2, Brushes.Black, 10, yloc)
e.Graphics.DrawString(dvProducts.Rows(I).Cells(1).Value, font2, Brushes.Black, 110, yloc)
e.Graphics.DrawString(Val(dvProducts.Rows(I).Cells(2).Value).ToString("N"), font2, Brushes.Black, 150, yloc)
e.Graphics.DrawString(dvProducts.Rows(I).Cells(3).Value, font2, Brushes.Black, 230, yloc, left)
End If
Next