Solved

DrawText and Pound sign

Posted on 1998-09-30
7
791 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

726 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