473,397 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Labels

OuTCasT
374 256MB
Hi
I would just like to know how i would limit a labels character to a maximum of 6 ???
I have a calculation that brings a result into a label but now the full answer is displayed, which wld be like 21.2565458658966 and i would like to only have the first 6 characters, 21.25

something like that
Feb 11 '08 #1
7 1242
devonknows
137 100+
Hi
I would just like to know how i would limit a labels character to a maximum of 6 ???
I have a calculation that brings a result into a label but now the full answer is displayed, which wld be like 21.2565458658966 and i would like to only have the first 6 characters, 21.25

something like that
One way for you to do that, is convert it to a single, you will get about 8 characters from the example you gave above,
Expand|Select|Wrap|Line Numbers
  1.     dim Result as single
  2.      Result = 21.2565458658966 
  3.      Result = csngl(Result) '// Result for This = 21.25655
  4. MyLabel.Caption = Result
  5.  
  6.  
Or you can cut the length via the Left$ sub
Expand|Select|Wrap|Line Numbers
  1.     dim Result as Double
  2.     Result = 21.2565458658966
  3. '//Change the Number 6 below for different legnths
  4.     MyLabel.Caption = Left$(Result, 6) '//Result for this shows 21.256
  5.  
I hope this helps you
Kind Regards
Devon
Feb 11 '08 #2
OuTCasT
374 256MB
One way for you to do that, is convert it to a single, you will get about 8 characters from the example you gave above,
Expand|Select|Wrap|Line Numbers
  1.     dim Result as single
  2.      Result = 21.2565458658966 
  3.      Result = csngl(Result) '// Result for This = 21.25655
  4. MyLabel.Caption = Result
  5.  
  6.  
Or you can cut the length via the Left$ sub
Expand|Select|Wrap|Line Numbers
  1.     dim Result as Double
  2.     Result = 21.2565458658966
  3. '//Change the Number 6 below for different legnths
  4.     MyLabel.Caption = Left$(Result, 6) '//Result for this shows 21.256
  5.  
I hope this helps you
Kind Regards
Devon

it says..... Conversion from label.text to single is not allowed
Feb 11 '08 #3
OuTCasT
374 256MB
One way for you to do that, is convert it to a single, you will get about 8 characters from the example you gave above,
Expand|Select|Wrap|Line Numbers
  1.     dim Result as single
  2.      Result = 21.2565458658966 
  3.      Result = csngl(Result) '// Result for This = 21.25655
  4. MyLabel.Caption = Result
  5.  
  6.  
Or you can cut the length via the Left$ sub
Expand|Select|Wrap|Line Numbers
  1.     dim Result as Double
  2.     Result = 21.2565458658966
  3. '//Change the Number 6 below for different legnths
  4.     MyLabel.Caption = Left$(Result, 6) '//Result for this shows 21.256
  5.  
I hope this helps you
Kind Regards
Devon

Hi Devon.
I got the problem.
i used variables
Expand|Select|Wrap|Line Numbers
  1. DIM v as decimal
and i changed it to single and now it works fine.

THanks
Feb 11 '08 #4
jamesd0142
469 256MB
Could you not use:

Expand|Select|Wrap|Line Numbers
  1. label = mid(label,1,6)
  2.  
Feb 11 '08 #5
devonknows
137 100+
Hmm, the difference being ure using a new version of Visual Basic or your in .NET that might be were the confusion came in, apologies for that.

I hope i offered a breif insight into what you needed
Kind Regards
Devon
Feb 11 '08 #6
OuTCasT
374 256MB
Hmm, the difference being ure using a new version of Visual Basic or your in .NET that might be were the confusion came in, apologies for that.

I hope i offered a breif insight into what you needed
Kind Regards
Devon

No you did get me on the right track so it's all good.

Thanks Devon
Feb 12 '08 #7
debasisdas
8,127 Expert 4TB
Have anyone considered using the Round function.
Feb 12 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: madeo | last post by:
hi, i'm looking for some script which would export address labels from a mysql db to pdf ... There's an exapmle, but i'm not able to convert it for using with mysql ... can anybody help? THX...
2
by: Martin O'Rourke | last post by:
All, I am hoping someone might be able to put me out of my misery and let me know if it is possible or not to dervie the name of an element in a form, based on its associated label, only knowing...
2
by: DBQueen | last post by:
I have a database which will be printing out labels for SMALL test tubes (1/4" high). We have yet to find a reasonably-priced printer (labelwriter) which can effectively print this on ROLLS of...
6
by: DebbieG | last post by:
I am creating a database for a small department in a university. Each student in their database can have 2 mailing addresses. They wanted mailing labels pulling just the 1st address. No problem....
3
by: Grim Reaper | last post by:
I print mailing labels out of Access 2000 databases about 3 to 4 times a week. I have been having problems with one thing since I have been printing mailing labels. I print mailing labels by...
3
by: Grim Reaper | last post by:
I know this is probably an easy question, but I could not find/figure it out. Basically, I am printing mailing labels with a "Sorting/Grouping" section that groups the label types together....
2
by: John Smith | last post by:
Perhaps the wrong place to ask but...Friend has names and addresses in Microsoft Works Database...how can she print off address labels from this database? Thanks, John
10
by: John Baker | last post by:
Hi: I have a user who has labels that are set up 3 across and 11 vertical (which is unusual at best), and he wants me to print names and addresses on them. I have already set up for labels 10...
6
by: Ron | last post by:
Hi, I know Access allows for easy construction of a report setup to print labels from a table/query, etc. I've done that one. It works pretty well for what I need. However, is there an...
0
by: xikom01 | last post by:
In this age, there is a lot of focus on the importance of "getting organized." There are even professional organizers for hire! Labels are a huge presence in the field of organization, because they...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.