lightweight grid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • build

    #1

    lightweight grid

    G'day all,
    I want to load comma sep text files and display it in a grid. I'd like
    something simple and lightweight. Don't need to edit it in grid, I could
    do that in textboxes if required.
    tia
    build
  • Philip Korolev

    #2
    Re: lightweight grid

    read the file with a streamreader and add the content to a table row.bind the table to a grid. hope this helps

    phil
    "build" <build02DELTHIS @datafast.net.a u> wrote in message news:416a256f@n ews.alphalink.c om.au...
    G'day all,
    I want to load comma sep text files and display it in a grid. I'd like
    something simple and lightweight. Don't need to edit it in grid, I could
    do that in textboxes if required.
    tia
    build

    Comment

    • Rick Rothstein

      #3
      Re: lightweight grid

      > I want to load comma sep text files and display it in a grid. I'd like[color=blue]
      > something simple and lightweight. Don't need to edit it in grid, I[/color]
      could[color=blue]
      > do that in textboxes if required.[/color]

      If you use an MSFlexGrid control, you can load your CSV text files via
      the Clip property (which requires you to select enough cells to house
      all the data... for what you want, simply select the entire grid). Place
      a MSFlexGrid on your form and give this code a try...

      Rick - MVP

      Dim FileNum As Integer
      Dim TotalFile As String
      FileNum = FreeFile
      ' Reads the entire file into memory all at once
      Open "c:\SomeDirecto ry\TextFile.txt " For Binary As #FileNum
      TotalFile = Space(LOF(FileN um))
      Get #FileNum, , TotalFile
      Close #FileNum
      TotalFile = Replace(Replace (TotalFile, vbNewLine, vbCr), ",", vbTab)
      With MSFlexGrid1
      ' Assuming user can't select a cell
      ' .HighLight = flexHighlightNe ver
      ' Select every cell
      .Row = .FixedRows
      .Col = .FixedCols
      .RowSel = .Rows - 1
      .ColSel = .Cols - 1
      ' Fill them
      .Clip = TotalFile
      ' Get rid of selection and pick cell to be active
      .Row = 1
      .Col = 1
      End With

      Comment

      Working...