[Gambas-user] DataSource

Fabien Bodard gambas.fr at gmail.com
Sun Nov 22 22:59:21 CET 2020


I need help..

I want my datasource reach a given line given one field and not a line
index... how can I achieve that quickly ... Actually I'm doing it by a
Force and stupid way.


Static Private reference As String

Public Sub Run(Value As String)

  reference = Value
  FClientEdit.Showmodal

End

Public Sub Form_Open()

  Dim i As Integer
  Dim aGeo As String[]

'----- HERE HOW TO FIND LINE :-/ --------------
  DataSource1.MoveFirst
  For i = 0 To DataSource1.Count - 1
    If DataSource1["reference"] = reference Then Break
    DataSource1.MoveNext
  Next
'-------------------------------------------

  Me.Text = DataSource1["reference"] & " - " & DataSource1["nom"] & "
" & DataSource1["prenom"]

  If Not DataSource1!geo Then
    MapView1.Enabled = False
  Else
    MapView1.Map.AddTile("OpenStreetMap",
"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", Null).Copyright =
"© OpenStreetMap " & ("contributors")
    MapView1.Map.Zoom = 12
    MapView1.Map.AddShape("clients")
    aGeo = Split(DataSource1!geo, " ")
    MapView1.Map.Center = MapPoint(aGeo[0], aGeo[1])
    MapView1.Map["clients"].AddPoint(DataSource1!reference,
MapPoint(aGeo[0], aGeo[1]))
  Endif

End


-- 
Fabien Bodard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Capture d??cran du 2020-11-22 22-59-05.png
Type: image/png
Size: 103331 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20201122/fc58354b/attachment-0001.png>


More information about the User mailing list