Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format lines of text box

Status
Not open for further replies.

GTO

Programmer
Jul 11, 2000
40
US
'Any helpful tips on how to accomplish this is appreciated
'How to allow for different fonts(widths)

Private Sub cmdTest
Dim sSpace As String
sBarScan = "077472006809"
'sBarScan = left(MSComm1.Input, 12)
rs.Open ("SELECT ItemDescription, Amount, TaxRate from DeptInfo where Identifier = '" & sBarScan & "'")
sSpace = Space(17 - Len(rs(0)))

If rs(2) <> &quot;&quot; Then sTaxRate = &quot; Tx&quot; & rs(2)

'trying to format text1 so that description is all the way left, allow for 16 chars,
'description, then 1 space, Then T1, then amount all the way to the right
'something like the following lines

'Left Margin(Descriptin Tax and amount across one line of text1) Right Margin

' Should look like the following line

'Dap Sealant Oils 1.89'

'you can see I've been trying various things, but nothing works well

sReadDB = Format$(rs(0), &quot;!@@@@@@@@@@@@@@@&quot;)
sReadDB = left(sReadDB, 17)
'& sSpace & sTaxRate & vbTab & rs(1)
'sReadDB = rs(0) & sSpace & sTaxRate & vbTab & rs(1)

Text1 = Text1 & sReadDB & sTaxRate & rs(1) & vbCrLf
rs.Close
End Sub

Thanks in advance
 
Look up the LSet command. Something like the following:

sReadDB=space(17)
LSet sReadDB=Left(rs(0),16)
sReadDB=sReadDB+sTaxRate+vbTab+rs(1)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top