Autore Topic: Assegnare parti di testo, avente struttura costante, in una GridView  (Letto 377 volte)

Offline vuott

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 11.597
  • Ne mors quidem nos iunget
    • Mostra profilo
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »

Offline Gianluigi

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 4.217
  • Tonno verde
    • Mostra profilo
Re:Assegnare parti di testo, avente struttura costante, in una GridView
« Risposta #1 il: 06 Agosto 2024, 23:45:14 »
Io lo farei così:
Codice: [Seleziona]
'' gb.util need

Private hGrid As GridView

Public Sub Form_Open()

  With Me
    .H = 360
    .W = 400
    .Arrangement = Arrange.Vertical
    .Margin = True
  End With
  With hGrid = New GridView(Me)
    .Expand = True
    .Header = GridView.Both
    .Columns.Count = 3
    .Columns[0].Text = "DATUM"
    .Columns[0].Width = 120
    .Columns[1].Text = "PRODUKT"
    .Columns[1].Width = 120
    .Columns[2].Text = "PREIS"
  End With
  UpPriceList

End

Private Sub UpPriceList()

  Dim hList As CsvFile
  Dim cList As Collection
  Dim i As Integer
  Dim s, sPath As String

  sPath = "./output.txt"
  hList = New CsvFile(sPath, "|") ' opens in reading
  While Not hList.Eof
    hGrid.Rows.Count += 1
    cList = hList.Read()
    hGrid[i, 0].Text = cList!Datum
    hGrid[i, 1].Text = cList!Produkt
    hGrid[i, 2].Text = cList!Preis
    Inc i
  Wend
  hList.Close

End
Dimenticavo di allegare il file di testo che deve mostrare/avere le intestazioni...
« Ultima modifica: 06 Agosto 2024, 23:53:41 da Gianluigi »
nuoto in attesa del bacio di una principessa che mi trasformi in un gambero azzurro