flexgrid save into CSV file


Now I am using VB already search a result and show on the Flexgrid, I just want to Export into csv file ,I need to open a small windows and change the location and name then save into csv or txt file.


Simon ChenNetwork AdministratorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


good morning!
try sumthing like this...

add commondialog control and command button on your form...

    Private Sub Command1_Click()
    Dim fileName As String
    Dim ctr As Integer
    CommonDialog1.Filter = "All Files (*.*)|*.*|" & _
                           "Text Files (*.txt)|*.txt"
    CommonDialog1.FilterIndex = 2                             ' Specify default filter
    CommonDialog1.DefaultExt = ".txt"
    fileName = Me.CommonDialog1.fileName
    Open fileName For Output As #1
    For ctr = 1 To flexgrid.rows -1
        Print #1,  flexgrid.textmatrix(ctr,0) & ", " &  flexgrid.textmatrix(ctr,1) & ", " &  flexgrid.textmatrix(ctr,2)
    Close #1
msgbox "Finished"
End Sub

'on this sample, i write the 1-3 columns of the flexgrid on the text file...
change the number on column on the specific column you wnat to write...

i hope i can give u idea...


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.