On Sep 28, 2006, at 5:14 AM, Mattia wrote:

With this code
  Dim s, s1, s2, s3, s4, s5, s6 as string
  Dim index,i as integer
  Dim x,y as integer
  x = 100
  y = 30
  index = ListBox1.ListCount - 1
  i = 0
  For i = 0 to index
    s1 = ListBox1.Cell(i,1)
    s2 = ListBox1.Cell(i,2)
    s3 = ListBox1.Cell(i,3)
    s4 = ListBox1.Cell(i,4)
    s5 = ListBox1.Cell(i,5)
    s6 = ListBox1.Cell(i,6)
s = s1 + " - " + s2 + " - " + s3 + " - " + s4 + " - " + s5 + " - " + s6

    //MsgBox(s)

    Dim g As Graphics
    g  = OpenPrinterDialog()
    If g<> Nil then
      g.DrawString s , (x, y)
    End if
    y=y + 10
  next

i want to print the entire listbox, but i print only one string for page and i want to print all string that one page contain...

 You have the following in every iteration of the For...Next loop:

Dim g As Graphics
 g  = OpenPrinterDialog()
 If g<> Nil then.....

Change the order of your code lines to the following.

  Dim s, s1, s2, s3, s4, s5, s6 as string
  Dim index,i as integer
  Dim x,y as integer
  x = 100
  y = 30
  index = ListBox1.ListCount - 1
  i = 0

  Dim g As Graphics
  g  = OpenPrinterDialog()

  If g<> Nil then

    For i = 0 to index
      s1 = ListBox1.Cell(i,0)
      s2 = ListBox1.Cell(i,1)
      s3 = ListBox1.Cell(i,2)
      s4 = ListBox1.Cell(i,3)
      s5 = ListBox1.Cell(i,4)
      s6 = ListBox1.Cell(i,5)
s = s1 + " - " + s2 + " - " + s3 + " - " + s4 + " - " + s5 + " - " + s6
      g.DrawString s , x, y
      y=y + 10
    next

  End If

You might also want to adjust y=y+10 to something a bit larger.

Terry

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to