Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB with extended ASCII-table

Status
Not open for further replies.

Periko

Programmer
Feb 24, 2003
134
BE
Hi folks,

I want to print a train of information i receive from a serial line in VB6 to my printer. This train contains graphical characters like chr$(196) (graphical dash). How can i put this on my printer like a dash, and not like an 'A' he's printing me now ?
any suggestions ????

Greetings...
Pedro...
 
Extended ASCII characters vary depending on the character set and the font in use. You will need to loop through your printer fonts to find one that gives the character that you want.

I did it with a form with a 375 x 375 textbox in the topleft, set to be the first member of an array of textboxes and called text1(0), and a command button called command1
[tt]
Private Sub Command1_Click()
Dim f as Long
For f = 1 To Printer.FontCount - 1
Load Text1(f)
With Text1(f)
.Visible = True
.Left = (f * 375) Mod Me.Width
.Top = 380 * ((f * 375) \ Me.Width)
.Font = Printer.Fonts(f)
.Text = Chr(196)
End With
Next
End Sub

Private Sub Text1_DblClick(Index As Integer)
Debug.Print Screen.Fonts(Index)
End Sub
[/tt]
This will loop through the printer fonts, with 1 charcter per box. If you doubleclick on the one you want, it's name appears in the Immediate window.

I'm afraid it's a bit quick and dirty, but you will get the idea

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
This gave me an idea, ok, i'll do some more testings...
Thanks for the tip !

Pedro...
 
Under Windows there is a Terninal font, that simulates DOS characters (with all pseudographics).
At least, it was on Win 95, 98.
 
There still is, and this method will find it, but he may find something a bit nicer...

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top