question

ClaudeLarocque-5662 avatar image
0 Votes"
ClaudeLarocque-5662 asked ClaudeLarocque-5662 commented

With Append.Text on a multi-line textbox align right

Hi everyone,
I try to find the way of aligning the currencies to the right as shown in the image below, here is the image followed by the code:

144991-aligncurrenciesright.gif


     Private Sub BtnAddToBasket_Click(sender As Object, e As EventArgs) Handles BtnAddToBasket.Click
         OthersTC.SelectedTab = ReceiptTP
         OrderTimeTB.Text = TimeOfDay
         ReceiptTB.AppendText(vbTab + vbTab + vbTab & "AUTO-CAISSE ORDERING SYSTEMS")
         ReceiptTB.AppendText(vbTab + vbTab + vbTab & "=========================================================================== " & vbNewLine)
         ReceiptTB.AppendText(" " + vbNewLine)
    
         ReceiptTB.AppendText("Name:" + vbTab + CustomerNameTB.Text + vbTab + "Phone No:" & CustomerPhoneTB.Text + vbTab +
                      "Ref.No:" & ReferenceTB.Text + vbNewLine)
         ReceiptTB.AppendText(vbNewLine + "Order date:" + vbTab & OrderDateTB.Text + vbTab + "Order time:" + vbTab & OrderTimeTB.Text + vbNewLine)
         ReceiptTB.AppendText(vbNewLine + "Item type " + vbTab + vbTab & "Qty " + vbTab & "Unit Price:" + vbTab & "Sub Total " + vbNewLine)
         ReceiptTB.AppendText(vbNewLine + "Nose ring: " + vbTab & Qty1TB.Text + vbTab & UnitPrice1TB.Text + vbTab + vbTab & SubTotal1TB.Text)
         ReceiptTB.AppendText(vbNewLine + "Earings: " + vbTab + vbTab & Qty2TB.Text + vbTab & UnitPrice2TB.Text + vbTab + vbTab & SubTotal2TB.Text)
         ReceiptTB.AppendText(vbNewLine + "Piercing jewelries: " + vbTab & Qty3TB.Text + vbTab & UnitPrice3TB.Text + vbTab + vbTab & SubTotal3TB.Text + vbNewLine)
         ReceiptTB.AppendText(vbNewLine + vbTab + vbTab + vbTab & "Order sub total: " + vbTab & OrderSubTotalTB.Text + vbNewLine)
         ReceiptTB.AppendText(vbNewLine + vbTab + vbTab + vbTab & "Tax1 on order: " + vbTab & Tax1TB.Text)
         ReceiptTB.AppendText(vbNewLine + vbTab + vbTab + vbTab & "Tax2 on order: " + vbTab & Tax2TB.Text)
         ReceiptTB.AppendText(vbNewLine + vbTab + vbTab + vbTab & "Tax3 on order: " + vbTab & Tax3TB.Text + vbNewLine)
         ReceiptTB.AppendText(vbNewLine + vbTab + vbTab + vbTab & "Order total: " + vbTab & TotalTB.Text + vbNewLine)
         ReceiptTB.AppendText(vbTab + vbTab + vbTab & "=========================================================================== " & vbNewLine)
         ReceiptTB.AppendText(vbTab + vbTab + vbTab & "THANK YOU FOR SHOPPING WITH US" + vbNewLine)
     End Sub


windows-10-network
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MotoX80 avatar image
0 Votes"
MotoX80 answered ClaudeLarocque-5662 commented

You have 9 characters in "Sub Total".

 Dim ColSize As Integer = 9
 ReceiptTB.AppendText(vbNewLine + vbTab + vbTab + vbTab & "Tax1 on order: " + vbTab & Strings.Right(Space(ColSize) & Tax1TB.Text, ColSize))


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you MotoX80, this is exactly what I needed, it works perfectly now that I know how to align fields.

Thanks so lot! Have a nice week-end

Claude

0 Votes 0 ·
djsanchezl avatar image
0 Votes"
djsanchezl answered

It is only a quick idea...

string.padleft(MaximumLength)

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ClaudeLarocque-5662 avatar image
0 Votes"
ClaudeLarocque-5662 answered

Thank you djanchezl,
I would like to try your suggestion, can you show me where in my code I will put this?
I am getting better in .net because of good programmer that helps like yourself.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.