Whing Dela Cruz
asked on
Printing Grid
How can i print 2 or more columns in grid?
My code below will only print 1 column
Please help!
Thanks
My code below will only print 1 column
Please help!
Thanks
Private Sub Command11_Click()
Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print GRID.TextMatrix(GRID.Row, 0); GRID.TextMatrix(GRID.Row, 1); GRID.TextMatrix(GRID.Row, 2)
Printer.EndDoc
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
changed DataGrid1 with the name of your Grid...
ASKER
Hi! another error message say's "Object doesn't support this property or method
For J = 0 to .columns.count - 1
For J = 0 to .columns.count - 1
check this link as well to find more example...
https://www.experts-exchange.com/simpleSearch.jsp
i hope i can give u idea...
game-master
Did you try my comment?
ASKER
yes sir, its working.. but its only print in one column. How to print more than 2 columns?
Can you add some idea Please..
Can you add some idea Please..
Do you mean somthing like this output?
ColumnVAlue1 ColumnVAlue2 ColumnVAlue3
ColumnVAlue1 ColumnVAlue2 ColumnVAlue3
ColumnVAlue1 ColumnVAlue2 ColumnVAlue3
Then Try this one:
Printer.Print GRID.TextMatrix(GRID.Row, 0) & vbTab & GRID.TextMatrix(GRID.Row, 1) & vbTab & Printer.Print GRID.TextMatrix(GRID.Row, 2)
ColumnVAlue1 ColumnVAlue2 ColumnVAlue3
ColumnVAlue1 ColumnVAlue2 ColumnVAlue3
ColumnVAlue1 ColumnVAlue2 ColumnVAlue3
Then Try this one:
Printer.Print GRID.TextMatrix(GRID.Row, 0) & vbTab & GRID.TextMatrix(GRID.Row, 1) & vbTab & Printer.Print GRID.TextMatrix(GRID.Row, 2)
ASKER
okey thanks! i will try it now...
ooppss... it should be like this
Printer.Print GRID.TextMatrix(GRID.Row, 0) & vbTab & GRID.TextMatrix(GRID.Row, 1) & vbTab & GRID.TextMatrix(GRID.Row, 2)
Printer.Print GRID.TextMatrix(GRID.Row, 0) & vbTab & GRID.TextMatrix(GRID.Row, 1) & vbTab & GRID.TextMatrix(GRID.Row, 2)
ASKER
Hi! When I try Only the last line has printed. There are 3 columns or line in my grid but it only print one line.
What shall i do now?
grid.bmp
What shall i do now?
grid.bmp
For i = 0 To GRID.Rows - 1
Printer.Print GRID.TextMatrix(i, 0) & vbTab & GRID.TextMatrix(i, 1) & vbTab & GRID.TextMatrix(i, 2)
Next
that should work now..
It should be like this:
Dim i as integer
For i = 0 To GRID.Rows.count - 1
Printer.Print GRID.TextMatrix(i, 0) & vbTab & GRID.TextMatrix(i, 1) & vbTab & GRID.TextMatrix(i, 2)
Next
This will print all the rows in your grid...
Dim i as integer
For i = 0 To GRID.Rows.count - 1
Printer.Print GRID.TextMatrix(i, 0) & vbTab & GRID.TextMatrix(i, 1) & vbTab & GRID.TextMatrix(i, 2)
Next
This will print all the rows in your grid...
i think that is what i have posted Jack..
ASKER
Hi! I tried it but an error appear like "Invalid qualifier"
"Rows is being highlighted"
For i = 0 To GRID.Rows.count - 1
"Rows is being highlighted"
For i = 0 To GRID.Rows.count - 1
TRY MY CODE...
REMOVE THE .COUNT...
game-master
ASKER
Hi! Thank you so much, I remove the .count now its working...
Can i ask some more questions? or do i need to post this to another question?
its about the alignment
The grid.textMatrix(i, 2) does not align its other example of the result
1 pck Paracetamol 500mg cap 1,900.00
2 bx Chloramphenicol 500 cap 865.00
5 pcs Reload Plus 300.00
6 pcd deras ssm 362.00
The problem is the alignment of the row
thanks!
Can i ask some more questions? or do i need to post this to another question?
its about the alignment
The grid.textMatrix(i, 2) does not align its other example of the result
1 pck Paracetamol 500mg cap 1,900.00
2 bx Chloramphenicol 500 cap 865.00
5 pcs Reload Plus 300.00
6 pcd deras ssm 362.00
The problem is the alignment of the row
thanks!
it is ok...
the alignment is unorganized because of the different length of the text...
u can align the result have some sort "cheating"....:-)
do sumthng like this...but im not quiet sure it works fine...
Printer.Print GRID.TextMatrix(i, 0) & Space(5) & vbTab & trim(GRID.TextMatrix(i, 1) ) & Space(5) & vbTab & trim(GRID.TextMatrix(i, 2))
it means that ur adding 5 spaces on each text before the tab..
have some try...
game-master
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Any progress here?
ASKER
Yes sir, the alignment of GRID.TextMatrix(i, 0) and GRID.TextMatrix(i, 1) are exactly aligned
but i don't know the GRID.TextMatrix(i, 2) did not align
here's the result
1 pc Dn Sample 15.00
2 pc kmj sample2lko 98.00
3 pc nm Sapmle 89.00
Can you add some?
Thanks!
but i don't know the GRID.TextMatrix(i, 2) did not align
here's the result
1 pc Dn Sample 15.00
2 pc kmj sample2lko 98.00
3 pc nm Sapmle 89.00
Can you add some?
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i"ll try it now thanks
ASKER
hi! sorry an error messages say like " invalid procedure call or argument"
Can you show your code?
on what part of the code shows the error?
ASKER
Private Sub Command11_Click()
Dim i As Integer
Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print ""
Dim x As Integer
For i = 0 To grid.Rows - 1
x = 30 - Len(Trim(grid.TextMatrix(i , 1)))
Printer.Print grid.TextMatrix(i, 0) & Space(5) & vbTab & Trim(grid.TextMatrix(i, 1)) & Space(x) & vbTab & Trim(grid.TextMatrix(i, 2))
Next
Printer.EndDoc
End Sub
Dim i As Integer
Printer.Print ""
Printer.Print ""
Printer.Print ""
Printer.Print ""
Dim x As Integer
For i = 0 To grid.Rows - 1
x = 30 - Len(Trim(grid.TextMatrix(i
Printer.Print grid.TextMatrix(i, 0) & Space(5) & vbTab & Trim(grid.TextMatrix(i, 1)) & Space(x) & vbTab & Trim(grid.TextMatrix(i, 2))
Next
Printer.EndDoc
End Sub
good morning!
im sorry for the late reply bcoz i got sicked...
on what line on the codes shows the error?
game-master
ASKER
Hi! Thanks, I hope that you are in good condition right now..
I actually proceed to another project cause my problem on printing doesn't yet been solve.
I'm happy for your coming because i believed that you can help me about this problem.
i will recall it right now and chat you ASAP.
Thank you so much!
I actually proceed to another project cause my problem on printing doesn't yet been solve.
I'm happy for your coming because i believed that you can help me about this problem.
i will recall it right now and chat you ASAP.
Thank you so much!
May sakit daw? Ows...
ASKER
Hi! I'm using this code
For i = 0 To grid.Rows - 1
x = 30 - Len(Trim(grid.TextMatrix(i , 1)))
Printer.Print grid.TextMatrix(i, 0) & Space(5) & vbTab & Trim(grid.TextMatrix(i, 1)) & Space(x) & vbTab & Trim(grid.TextMatrix(i, 2))
Next
As i observed upon printing when grid.TextMatrix(i, 1) is composed of long character the alignment will become disorder. But if the character is almost the same length then the printing alignment will have a good alignment.
I tried it many times but still not working.. I hope you can give more ideas
Thanks!
For i = 0 To grid.Rows - 1
x = 30 - Len(Trim(grid.TextMatrix(i
Printer.Print grid.TextMatrix(i, 0) & Space(5) & vbTab & Trim(grid.TextMatrix(i, 1)) & Space(x) & vbTab & Trim(grid.TextMatrix(i, 2))
Next
As i observed upon printing when grid.TextMatrix(i, 1) is composed of long character the alignment will become disorder. But if the character is almost the same length then the printing alignment will have a good alignment.
I tried it many times but still not working.. I hope you can give more ideas
Thanks!
ASKER
Hello jackofPh!
saan ka sa pilinas? Poyde mo akong matulungan sa problemang ito!
saan ka sa pilinas? Poyde mo akong matulungan sa problemang ito!
Dito sa munoz, nakatira ako sa cubao, ikaw?
ASKER
Cebuano po ako! Sa mindanao
Gusto po akong mag pa tutor ng vb.net na maybayad. maari ba kitang ma kuha na magtutor sa skin kahit sa email lang. Mag online po ako sa iyo ng pera, bigay mo lang sa akin ang accnt no. mo. Poyde ma send mo sa akin ang cel no. mo.
Thanks!
Gusto po akong mag pa tutor ng vb.net na maybayad. maari ba kitang ma kuha na magtutor sa skin kahit sa email lang. Mag online po ako sa iyo ng pera, bigay mo lang sa akin ang accnt no. mo. Poyde ma send mo sa akin ang cel no. mo.
Thanks!
Let me think first...
ASKER
Okey, Thanks!
any progress?
ASKER
yes sir, same problem!
Can you help me now?
Can you help me now?
unfortunately, that is somehow the limitation of printer.print...
specially with regards to alignment...
as what i have said before, in order to make the alignment correct,
you should set for the specific length of string on each each column..
otherwise, alignment may not look the way as u want....
game-master
ASKER
Can you add some..
Thanks