i have Msflexgrid with two column (Invoice No and Amount) say 5 rows

Invoice no column is left align and amount column is right align

i want to transfer this 5 rows data to a single text box i.e entire grid data to single text box

invoice no should be left align and amount should be right align in text box

any advise as how can it be achived

thanks

So you want to get data from grid to One Textbox only?
Post your code how far you doing this?

Private Sub Command1_Click()
Dim GRN As Integer

For GRN = 1 To FGRID1.Rows - 1
Text6.Text = Text6.Text & vbCrLf & FGRID1.TextMatrix(GRN, 0) & vbTab & FGRID1.TextMatrix(GRN, 2)


Next GRN
End Sub

result is

148950      65,106.97
148952      83,539.68
149210      71,559.68
149067      73,957.75
149444      24,415.11
149433      83,539.68
149432      65,106.97
149020      248,990.85
149973      72,481.50
150088      123,342.91
150140      3.00

i want

148950       65,106.97
148952       83,539.68
149210       71,559.68
149067       73,957.75
149444       24,415.11
149433       83,539.68
149432       65,106.97
149020      248,990.85
149973       72,481.50
150088      123,342.91
150140            3.00

i.e amount column right align.
thanks

Edited 3 Years Ago by Dani: Fixed formatting

Use Format function to make it right aligned.
Also change textbox font to Courier New.

Private Sub Command1_Click()
Dim GRN As Integer
With FGRID1
    For GRN = 1 To .Rows - 1
        Text6.Text = Text6.Text & vbCrLf & .TextMatrix(GRN, 0) & vbTab & _
        Format$(Format$(.TextMatrix(GRN, 2), "##0.00"), "@@@@@@@@@@@@@")

    Next i
End With
End Sub

Edited 5 Years Ago by Jx_Man: n/a

hi

the problem of alignment of text is solved in text box .But

actullay the above textbox data forms body of email in msoutlook and the alignment of text goes off in email body text as required above unless the text in email is Courier New.

is there a way i can change the font type of outlook new mail to Courier New through VB

below is my code

Set oOApp = CreateObject("Outlook.Application")
Set oOMail = oOApp.CreateItem(olMailItem)
With oOMail
.To = Text1.Text
.CC = Text2.Text & ";" & Text3.Text
.Subject = Text4.Text
.Body = Text5.Text
.Send
End With

Hi,
You make this thread Unsolved and you ask the different question now..
Please keep the originally question of this thread about how to transfer data from flexgrid.
Also, you already have a new thread about your question.

This question has already been answered. Start a new discussion instead.