can listbox control have both a horizontal and vertical scroll bar sim

Hi
I am having some growing pains here in trying to use ADO and using a control(in this case the listbox) to display a comma delimited data file with around 234 fields in each record. I have gotten to the point where the data file is correctly going into the listbox to the limitation where I am able to display the first 4 fields out of the total 234 fields. Am I asking too much of a listbox. I need for the listbox to have both horizontal and vertical scrolling capability to access all the data information which is 234 fields, not 4 fields!
It does not appear in my research that a listbox is capable of having both horizontal and vertical scrolling capabilities simultaneously. Am I wrong. How can this be done or is there another control or Active X Control that can perform this task more efficiently.
I f you like you can see the data file structure of these data files I am using at the URL

www.brisnet.com/cgi-bin/static.cgi?page=structures

or if you wish I can email you attached data files that I am actually working with.

My form contains 1 listbox lstData
2 command buttons cmdGetData and cmdExit

Below is my code:

Option Explicit
Dim oConn As New ADODB.Connection
Dim oRS As New ADODB.Recordset

Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub cmdGetData_Click()
Dim ofield As ADODB.Field
Dim Counter As Integer
Dim LineTemp As String
Dim SpacePad As String
SpacePad = Space(20)

'oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
'& "Data Source=" & "C:Temp" & ";" _
'& "Extended Properties='text;FMT=Delimited'"

'--USE FOLLOWING CONNECTION STRING IF THE TEXT FILE
'DOESN'T HAVE A HEADER FOR FIELD NAMES
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & "C:Temp" & ";" _
& "Extended Properties='text;HDR=NO;" _
& "FMT=Delimited'"

'Set oRS = OConn.Execute("Select * from ddd.txt")
'note that the above ccode line is commented out
'and replaced with below line of code

oRS.Open "Select * from SUF1110a.txt", oConn, adOpenStatic


For Counter = 1 To oRS.Fields.Count
LineTemp = LineTemp & Left(oRS.Fields(Counter - 1). _
Name & SpacePad, 18)
Next Counter
Me.lstData.AddItem LineTemp

Do Until oRS.EOF
LineTemp = ""
For Counter = 1 To oRS.Fields.Count
LineTemp = LineTemp & Left(oRS.Fields(Counter - 1).Value _
& SpacePad, 18)
Next Counter
Me.lstData.AddItem LineTemp
oRS.MoveNext
Loop

'Must clean up!
oRS.Close
Set oRS = Nothing
Set oConn = Nothing

End Sub


My end mission is to take about 8 fields out of the 234 fields and extract those values into an EXCEL spreadsheet to manipulate those values from within the spreadsheet. Appreciate any input on my question and mission here.Thanx!


MAKO

Comments

  • : My form contains 1 listbox lstData
    : 2 command buttons cmdGetData and cmdExit

    [red]replace the listbox with a FlexGrid or some other Grid control that you have. You're trying to display tabular data in a list control which just doesn't make sense.[/red]

    : Option Explicit
    : Dim oConn As New ADODB.Connection
    : Dim oRS As New ADODB.Recordset
    :
    : Private Sub cmdExit_Click()
    : Unload Me
    : End Sub
    :
    : Private Sub cmdGetData_Click()
    : Dim ofield As ADODB.Field
    : Dim Counter As Integer
    : Dim LineTemp As String
    : Dim SpacePad As String
    : SpacePad = Space(20)
    :
    : 'oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
    : '& "Data Source=" & "C:Temp" & ";" _
    : '& "Extended Properties='text;FMT=Delimited'"
    :
    : '--USE FOLLOWING CONNECTION STRING IF THE TEXT FILE
    : 'DOESN'T HAVE A HEADER FOR FIELD NAMES
    : oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
    : & "Data Source=" & "C:Temp" & ";" _
    : & "Extended Properties='text;HDR=NO;" _
    : & "FMT=Delimited'"
    :
    : 'Set oRS = OConn.Execute("Select * from ddd.txt")
    : 'note that the above ccode line is commented out
    : 'and replaced with below line of code
    :
    : oRS.Open "Select * from SUF1110a.txt", oConn, adOpenStatic

    [red]Set Me.FlexGrid1.DataSource = oRS[/red]

    : 'Must clean up!
    : oRS.Close
    : Set oRS = Nothing
    : Set oConn = Nothing
    :
    : End Sub
    :
    :
    : My end mission is to take about 8 fields out of the 234 fields and extract those values into an EXCEL spreadsheet to manipulate those values from within the spreadsheet. Appreciate any input on my question and mission here.Thanx!

    [red]If you use a grid then you can refer to any of the fields by a column index.[/red]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion