document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. \' Gambas class file
  2.  
  3. Public Struct datos
  4.     asunto As String
  5.     color As Integer
  6.     fecha As Date
  7.     descripcion As String
  8. End Struct
  9.  
  10. Private ges As New GestionarDatos
  11.  
  12. Public Sub _new()
  13.    
  14.     limpio()
  15.    
  16. End
  17.  
  18. Public Sub Form_Open()
  19.    
  20.     Me.text = "Ejemplo de Estructuras: Programa Recordatorio"
  21.     Me.center
  22.    
  23. End
  24.  
  25. Public Sub ButtonAdd_Click()
  26.    
  27.     Dim registroTmp As Datos
  28.    
  29.     registroTmp = New Datos \'instancio
  30.     registroTmp.asunto = TextBoxAsunto.Text
  31.     registroTmp.color = ColorButtonNivelImportancia.Value
  32.     registroTmp.fecha = DateBoxFecha.Value
  33.     registroTmp.descripcion = TextAreaDescripcion.Text
  34.     \'añado el regitro usando el método .add
  35.     ges.add(registroTmp)    
  36.     \'borro datos
  37.     limpio()
  38.     \'pongo el Id del registro
  39.     ValueBoxIndice.value = ges.getNumeroRegistros() + 1
  40.    
  41. End
  42.  
  43. \'-------------------------------------
  44. Public Sub limpio()
  45.    
  46.     TextAreaDescripcion.text = ""
  47.     TextBoxAsunto.text = ""
  48.     ColorButtonNivelImportancia.value = Color.White
  49.     DateBoxFecha.value = Now \'fecha actual
  50.    
  51. End
  52.  
  53. Public Sub ButtonIr_Click()
  54.    
  55.     Dim registroTmp As Datos
  56.    
  57.     registroTmp = ges.rescata(ValueBoxIndice.value)
  58.    
  59.     If IsNull(registroTmp) Then
  60.         \'el indice ha sido mal introducido y no puedo hacer nada....
  61.     Else
  62.        
  63.         TextBoxAsunto.text = registroTmp.asunto
  64.         TextAreaDescripcion.text = registroTmp.descripcion
  65.         DateBoxFecha.value = registroTmp.fecha
  66.         ColorButtonNivelImportancia.value = registroTmp.color
  67.     Endif
  68.    
  69. End
  70.  
  71. Public Sub ButtonBorrar_Click()
  72.    
  73.     \'intengo borrar el indice indicado...
  74.     ges.erase(ValueBoxIndice.value)
  75.     If ges.erase(ValueBoxIndice.value) = True Then
  76.         limpio()
  77.     Endif
  78.    
  79. End
  80.  
  81. Public Sub ButtonPrimero_Click()
  82.    
  83.     ValueBoxIndice.value = 0
  84.     ges.setIndice(0)
  85.     ButtonIr_Click()
  86.    
  87. End
  88.  
  89. Public Sub ButtonUltimo_Click()
  90.    
  91.     ValueBoxIndice.value = ges.getNumeroRegistros()
  92.     ges.setIndice(ges.getNumeroRegistros())
  93.     ButtonIr_Click()
  94.    
  95. End
  96.  
  97. Public Sub ButtonAtras_Click()
  98.    
  99.     ges.setIndice(ges.getIndice() - 1)
  100.     ValueBoxIndice.value = ges.getIndice()  
  101.     ButtonIr_Click()
  102.    
  103. End
  104.  
  105. Public Sub ButtonSiguiente_Click()
  106.    
  107.     ges.setIndice(ges.getIndice() + 1)
  108.     ValueBoxIndice.value = ges.getIndice()  
  109.     ButtonIr_Click()
  110.    
  111. End
  112.  
  113. Public Sub ButtonModificar_Click()
  114.    
  115.     \'segun el indice donde estoy, lo edito...
  116.     \'
  117.     Dim registroTmp As Datos
  118.    
  119.     registroTmp = New Datos \'instancio
  120.     registroTmp.asunto = TextBoxAsunto.Text
  121.     registroTmp.color = ColorButtonNivelImportancia.Value
  122.     registroTmp.fecha = DateBoxFecha.Value
  123.     registroTmp.descripcion = TextAreaDescripcion.Text
  124.     \'añado el regitro usando el método .add
  125.     ges.modificar(registroTmp, ValueBoxIndice.value)    
  126.    
  127. End
  128.  
  129. Public Sub ButtonLeerDatos_Click()
  130.    
  131.     ges.leerdatos()
  132.     ButtonPrimero_Click()
  133.    
  134. End
  135.  
  136. Public Sub ButtonGuardarDatos_Click()
  137.    
  138.     ges.guardardatos()
  139.    
  140. End
');