[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

DrawText and Pound sign

Posted on 1998-09-30
7
Medium Priority
?
797 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 2

Accepted Solution

by:
Grdv earned 120 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

649 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