document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. \' Gambas class file
  2.  
  3. Private hconn As Connection
  4.  
  5. Private hresult As Result
  6.  
  7. Public Sub _new()
  8.  
  9. End
  10.  
  11. Public Sub Form_Open()
  12.  
  13.   ModComun.copiarBase()
  14.  
  15.   hconn = ModComun.ConectarBase()
  16.  
  17.   hresult = hconn.Exec("select * from personas") \'para tenertodos los registros en el hresul
  18.  
  19.   \'relleno etiquetas..
  20.   LabelTotalRegistros.text = " de " & Str$(hresult.count)
  21.  
  22.   \'cargo primer registro
  23.   ButtonPrimero_Click()
  24.  
  25. End
  26.  
  27. Public Function mostrarRegistro() As Boolean
  28.  
  29.   If hresult.Available Then
  30.    
  31.     TextBoxNombre.text = hresult["nombre"]
  32.     ValueBoxEdad.value = hresult["edad"]
  33.     ValueBoxRegistro.value = hresult.Index + 1
  34.     Return True \'ok, ha sido posible mostrar datos
  35.   Endif
  36.  
  37.   Message.Info("No es posible desplazarse más")
  38.  
  39.   Return False \'no ha sido posible ir a ese registro
  40.  
  41. End
  42.  
  43. Public Sub ButtonPrimero_Click()
  44.  
  45.   hresult.MoveFirst  
  46.   mostrarRegistro()
  47.  
  48. End
  49.  
  50. Public Sub ButtonSiguiente_Click()
  51.  
  52.   If (hresult.index + 1) < hresult.count Then
  53.     hresult.MoveNext
  54.     mostrarRegistro()
  55.    
  56.   Endif
  57.  
  58. End
  59.  
  60. Public Sub ButtonAnterior_Click()
  61.  
  62.   If hresult.Index > 0 Then
  63.    
  64.     hresult.MovePrevious
  65.     mostrarRegistro()
  66.    
  67.   Endif
  68.  
  69. End
  70.  
  71. Public Sub ButtonUltimo_Click()
  72.  
  73.   hresult.MoveLast
  74.   mostrarRegistro()
  75.  
  76. End
  77.  
  78. Public Sub ValueBoxRegistro_KeyPress()
  79.   \'ir a un registro determinado... escribiendo el numero y la tecla Enter o Return
  80.  
  81.   If Key.code = Key.enter Or Key.code = Key.Return Then
  82.     If hresult.MoveTo(ValueBoxRegistro.value - 1) = False Then
  83.       mostrarRegistro()
  84.     Else
  85.       Message.Info("No existe ese registro")
  86.     Endif
  87.    
  88.   Endif
  89.  
  90. End
');