transfer a table to another form

Post

Posted
Rating:
#26
Guru
BruceSteers is in the usergroup ‘Guru’
Let me explain better when i say it is one or the other.

Examine the following code it shows you the 2 ways to fill a gridview.

I use Dir() on the home folder then add the directories to $aDirList string array for use with the GridView1_Data() event.
But the file list i add directly/manually to the GridView2

You must use one way or the other, you cannot fill a gridview manually AND use the data event.

Code (gambas)

  1. ' Gambas class file
  2.  
  3. Private $aDirList As New String[]
  4.  
  5. Public Sub Form_Open()
  6.  
  7.   GridView1.AddColumn("Dirs")
  8.   GridView2.AddColumn("Files")
  9.  
  10.   Dim aList As String[] = Dir(User.home)
  11.  
  12.   For Each sItem As String In aList
  13.  
  14.     If IsDir(User.Home &/ sItem) Then
  15.  
  16.       ' add to the array for later use in the GridView1_Data event.
  17.       $aDirList.Add(sItem)
  18.  
  19.     Else
  20.  
  21.       ' manually add files to GridView2 as there is no data event.
  22.       Inc GridView2.Rows.Count
  23.       GridView2[GridView2.Rows.Max, 0].Text = sItem
  24.  
  25.     Endif
  26.  
  27.   Next
  28.  
  29.   GridView1.Rows.Count = $aDirList.Count ' This is all we must set to use the GridView1_Data event
  30.  
  31.  
  32. Public Sub GridView1_Data(Row As Integer, (Column) As Integer)
  33.  
  34.   GridView1.Data.Text = $aDirList[Row]
  35.  
  36.  
  37.  

I hope that makes more sense for you.
Online now: No Back to the top

Post

Posted
Rating:
#27
Trainee

BruceSteers said

Let me explain better when i say it is one or the other.

Examine the following code it shows you the 2 ways to fill a gridview.

I use Dir() on the home folder then add the directories to $aDirList string array for use with the GridView1_Data() event.
But the file list i add directly/manually to the GridView2

You must use one way or the other, you cannot fill a gridview manually AND use the data event.

finally, I arrived at my result, although I constantly modified it, it didn't work, until I saw that the name of the procedure was incorrect!!!
Thank you all for your patience, now I know how to use a gridview… ;)
Online now: No Back to the top

Post

Posted
Rating:
#28
Guru
BruceSteers is in the usergroup ‘Guru’

lucien91 said

BruceSteers said

Hopefully we can still help

thank you, admit that it's frustrating for a French person to be forced to translate forums and texts when gambas was invented by a French person!

I thought there was not a French forum anymore but then i found this..
Le site de la communauté de Gambas - Gambas France

And this page looks like it may have many examples you may be interested in.
Le site de la communauté de Gambas - Gambas France

Home: Le site de la communauté de Gambas - Gambas France

Not trying to get rid of you but i thought you may find that forum good for your language :)
Online now: No Back to the top
1 guest and 0 members have just viewed this.