Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.visual.basic    |    MS Visual Basic discussions, NOT dot-net    |    10,840 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 8,880 of 10,840    |
|    Rick Rothstein to All    |
|    Re: lightweight grid    |
|    13 Oct 04 14:20:31    |
      From: rickNOSPAMnews@NOSPAMcomcast.net              > 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.              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:\SomeDirectory\TextFile.txt" For Binary As #FileNum       TotalFile = Space(LOF(FileNum))       Get #FileNum, , TotalFile       Close #FileNum       TotalFile = Replace(Replace(TotalFile, vbNewLine, vbCr), ",", vbTab)       With MSFlexGrid1        ' Assuming user can't select a cell       ' .HighLight = flexHighlightNever        ' 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              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca