Solved

DrawText and Pound sign

Posted on 1998-09-30
7
781 Views
Last Modified: 2008-03-06
How to put the English Pound sign in the text box and how to use DrawText to draw it on the form?
0
Comment
Question by:victorlong
  • 3
  • 3
7 Comments
 

Author Comment

by:victorlong
ID: 1437495
Edited text of question
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1437496
Hello Vic.....

What does the pound sign looks like..????????

to draw it on the formmmm use something like this....

Why not use the TextOut() Api since it's easier to use......

you need to use the GetDC() and ReleaseDC() API also...

Dim DC as Long
Dim T as LongBool 'Do you have LongBool in VB??? If not find something to be used...

DC = GetDC(Me.hWnd)
T = TextOut(DC, 100, 100, "Hello", 5)
DC = ReleaseDC(Me.hWnd, DC)

That would output it on the form at x : 100 and y : 100 ........

To display a character for the pound you need to give me what that character looks like...
for example this would display the © character.... if your font is set to Times

EditBox1.Text = $Chr(0169)

I hope this help a little, but I ain't VB programmer so I don't know many of the functions that VB uses.....

If you need some more help I'd try to help you/...

//Vik
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1437497
Oh I think this function goes like this Chr$(0169) instead of $Chr(0169) sorry for that....

//Vik
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 2

Accepted Solution

by:
Grdv earned 40 total points
ID: 1437498
you mean £ this sign???
in that case... just use either

Text1.Text = "£"

or use the same way of typing as viktornet did but the character code for "£" is 0163 so:

Text1.Text = Chr$(0163)

and to print it on the form in vb just write like this:

Me.CurrentX = (your x coordinate on the form)
Me.CurrentY = (your y coordinate on the form)
Me.Print Chr$(0163)

hope that helped...

0
 

Author Comment

by:victorlong
ID: 1437499
Hi Experts

Thank you very much.

I can see the "£" on my keyboard. Whenever need a "#" I just press it and every thing is fine. Now I need a "£" in my code but no way to put it to the code.

I will try chr$(163) and hope it can work in both of the textbox and the function DrawText.

Cheers
0
 

Author Comment

by:victorlong
ID: 1437500
Thanks to  viktornet also.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1437501
No problem.....Just remmember that the code for the character depends on the font you are using.... If you are using different font, the code for the pound character might be different, so you need to set the font to some font that you know exactly what the value is for a pound sign...

/./Viktor
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now