John Clark
John.Clark at niagaracounty.com
Fri Jan 30 13:47:32 CST 2004
This is pretty cool code. I thought about doing something like this, but
I thought it would be too 'difficult' or in-depth to make it worthwhile.
But, this is actually quite simple for what it accomplishes.
I really didn't want to use a universal font, and although I agree
w/Rocky about the right justify, it just doesn't look right in this
case. I was going to do that though, until I got this code.
Thanks Robert! This will be a keeper for me.
John
>>> rl_stewart at highstream.net 01/30/04 01:53PM >>>
Use a pad function to chance the text displayed and change the font to
a
mono-spaced font.
Here is the function. Watch out for line wrap.
Function PadString(strText As String, intWidth As Integer, _
strSide As String, Optional strPad As String = " ") As String
' Pad strText on either side, so the whole output is
' at least intWidth characters.
' If strText is longer than intWidth, just return strText.
' If strPad is wider than one character, this code only takes
' the first character for padding with it.
' Parameters:
' strText:
' Input text
' intWidth:
' Minimum width of the output. If
' Len(strText) < intWidth, then the
' output will be exactly intWidth characters
' wide. The code will not truncate strText,
' no matter what.
' strSide:
' This is either L or R for Left or Right
' strPad (Optional, default is " "):
' string whose first character will
' be used to pad the output.
' Returns:
' Return Value:
' strText, padded on the specified side with
' the first character of strPad.
' Example:
' PadString("Name", 10, "R", ".") returns
' "Name......"
'
If Len(strText) > intWidth Then
PadString = strText
End If
If strSide = "R" Then
PadString = Left$(strText & String(intWidth, strPad),
intWidth)
Else
PadString = Right$(String(intWidth, strPad) & strText,
intWidth)
End If
End Function
This will not align text to the center, only left or right.
Paste this into a module, then in the immediate window
type ? PadString("Name", 10, "R", ".")
You should see Name......
Robert
At 12:00 PM 1/30/2004 -0600, you wrote:
>Date: Fri, 30 Jan 2004 09:22:42 -0500
>From: "John Clark" <John.Clark at niagaracounty.com>
>Subject: [AccessD] This should be simple...but...
>To: <accessd at databaseadvisors.com>
>Message-ID: <s01a22c0.021 at nebnov1.niagaracounty.com>
>Content-Type: text/plain; charset=US-ASCII
>
>On a form I am working on, I am trying to provide 'leading dots',
>between the label and text box. I want to make all labels equal by
doing
>this, which means some will have more or less dots than others. I
>usually don't do this, because of what I am now experiencing; they
don't
>all line up. They are slightly off, but enough to notice.
>
>EXAMPLE: (These are slightly off also)
>
>Name ....................:
>Address .................:
>City ........................:
>St ..........................:
>Zip .........................:
>
>Any ideas on this? Maybe even alternatives?
>
>Thanks,
>J Wallace Clark (Hey, this lawerese is kinda fun)
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com