?
Solved

True DBGrid ExportToDelimitedFile missing Header record

Posted on 2003-04-01
6
Medium Priority
?
1,146 Views
Last Modified: 2007-12-19
True DBGrid 6.0
VB 6.0

I am currently using the ExportToDelimitedFile command as follows.

Grid.ExportToDelimitedFile sConvFileName, , ","

I would like to have the headers or as they call it the captions exported to the file also. Can this be done with True DBgrid? Is there another command that supports the export of the header record.

Thanks
0
Comment
Question by:Darebear
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 10

Accepted Solution

by:
aeklund earned 1000 total points
ID: 8247782
I don't know much about this 3rd party control, but here is a solution that will work:

  'Call your export function
  Grid.ExportToDelimitedFile sConvFileName, , ","
 
  'Now use this to add the Headers (to a new file)
  Dim sLine As String
  Open sConvFileName For Input As #1
 
  'Write Headers
  Open sConvFileName & "-headers.txt" For Output As #2
    Dim i As Integer
    For i = 0 To Grid.Columns.Count - 1
      If i = 0 Then
        sLine = Chr(34) & Grid.Columns(i).Caption & Chr(34)
      Else
        sLine = sLine & "," & Chr(34) & Grid.Columns(i).Caption & Chr(34)
      End If
    Next
    Print #2, sLine
   
    'Write contents of original file
    Do Until EOF(1)
      Line Input #1, sLine
      Print #2, sLine
    Loop
  Close
0
 

Author Comment

by:Darebear
ID: 8249944
The above solution works and I will award the points if nobody can provide the true dbgrid with in a day or two.

Thank you
0
 

Author Comment

by:Darebear
ID: 8253594
The above solution works and I will award the points if nobody can provide the true dbgrid with in a day or two.

Thank you
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 10

Expert Comment

by:aeklund
ID: 8254240
Great... I downloaded the help for the true dbgrig 8.0 (apex) and I don't see anywhere in the documentation on how to export the headers as the first row of your exported file.
0
 

Author Comment

by:Darebear
ID: 8275535
The points are all yours.
0
 
LVL 10

Expert Comment

by:aeklund
ID: 8284188
Glad to help.. thx for the points
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question