Solved

DrawText and Pound sign

Posted on 1998-09-30
7
790 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run code from text file in vb 1 73
Help me. 3 60
Need Nag Screen for Reboot if system up time is over 14 days 12 61
Powerpoint 2013: Change cell reference in excel link 3 81
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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

860 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