Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 24th, 2006, 10:04 PM
Authorized User
 
Join Date: Dec 2003
Location: Phnom Penh, KH, Cambodia.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ysiline Send a message via Yahoo to ysiline
Default Detect double line command button caption

Hi,

Does anyone got the idea that how can I check whether a command button got one line of caption or more than one line?

Wait to get helped.

Thanks,
Reply With Quote
  #2 (permalink)  
Old April 25th, 2006, 06:46 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I am not sure what you mean by this. The button can only have one caption line, but it can be split in two if the button is sized properly. The application will only see one line no matter how many lines it is split into visually, if I understand you.

Perhaps you can check the button height instead.

Why do you need to check this? Maybe there is another way.

HTH


mmcdonal
Reply With Quote
  #3 (permalink)  
Old April 25th, 2006, 10:04 PM
Authorized User
 
Join Date: Dec 2003
Location: Phnom Penh, KH, Cambodia.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ysiline Send a message via Yahoo to ysiline
Default

Well, thank you mmcdonal.

I did the solution using "Instr" function to search for the "vbcrlf" in the caption of button.

Regard,

Reply With Quote
  #4 (permalink)  
Old April 26th, 2006, 01:47 AM
Authorized User
 
Join Date: Mar 2006
Location: Bratislava, , Slovakia.
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
if you caption text is longer than width of Button, then will be split to two lines automatically without any newline symbol (e.g. vbNewLine, or other).
But, if you would like to search exact phrase vbNewLine in caption text, syntax is:

Dim position As Long
position = InStr(1, Button.Caption, vbNewLine, vbBinaryCompare)

If position > 0 Then
'there is more lines in text
End If

Peko

Reply With Quote
  #5 (permalink)  
Old April 26th, 2006, 06:30 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Thanks for that. I didn't know about vbNewLine (I usually use vbCrLf when I need this, but I haven't used it in button text.


mmcdonal
Reply With Quote
  #6 (permalink)  
Old April 26th, 2006, 09:30 PM
Authorized User
 
Join Date: Dec 2003
Location: Phnom Penh, KH, Cambodia.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ysiline Send a message via Yahoo to ysiline
Default

Ya, I get used to "vbCrlf" and it is good to get an easier one with "VbNewLine"

Thank,

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change button caption on continuous subform PeregrinTook Access VBA 2 April 16th, 2007 05:16 PM
do a double perl replace in one line crmpicco Perl 4 March 16th, 2007 08:53 AM
Control button caption and visible property chacquard Access VBA 7 September 9th, 2005 11:14 AM
Want to detect line breaks conundrum Classic ASP Basics 1 October 3rd, 2003 04:05 AM
How to detect window Close (X) Button cyberjames2003 Javascript How-To 2 July 27th, 2003 08:13 PM



All times are GMT -4. The time now is 11:51 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.