Advertisement
arielgatti444

Agregado a biblioteca de funciones

Jun 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -------------------------------------------------------------------------
  2. 'Funciones opcionales para agregar:'
  3.  
  4. public Sub llenarListaConCriterio (lstRef as Listbox, rsTabla as Recordset, datoLst as String, codigoLst as String, strCriterio as String)
  5.  
  6. lstRef.clear
  7.  
  8. rsTabla.FindFirst strCriterio
  9.  
  10. lstRef.AddItem "Seleccione una opcion"
  11. lstRef.ItemData(lstRef.NewIndex) = -1
  12. lstRef.NewIndex = 0
  13.  
  14. Do while not rsTabla.noMatch
  15.     lstRef.AddItem rsTabla(datoLst)
  16.     lstRef.itemData(lstRef.NewIndex) = rsTabla(codigoLst)
  17.     rsTabla.findNext strCriterio
  18. Loop
  19.  
  20. cerrarRs(rsTabla)
  21.  
  22. End Sub
  23.  
  24. ------------------------------------------------------------------------------------
  25.  
  26. public Sub llenarComboConCriterio (comboRef as Combobox, rsTabla as Recordset, datoLst as String, codigoLst as String, strCriterio as String)
  27.  
  28. comboRef.clear
  29.  
  30. rsTabla.FindFirst strCriterio
  31.  
  32. comboRef.AddItem "Seleccione una opcion"
  33. comboRef.ItemData(comboRef.NewIndex) = -1
  34. comboRef.NewIndex = 0
  35.  
  36. Do while not rsTabla.noMatch
  37.     comboRef.AddItem rsTabla(datoLst)
  38.     comboRef.itemData(comboRef.NewIndex) = rsTabla(codigoLst)
  39.     rsTabla.findNext strCriterio
  40. Loop
  41.  
  42. cerrarRs(rsTabla)
  43.  
  44. End Sub
  45.  
  46. --------------------------------------------------------------------------------------
  47.  
  48. private Function dameIndiceList (listRef as Listbox, intCodigo as Integer) as Integer
  49. Dim i as Integer  
  50.  
  51.     For i=0 To listRef.ListCount - 1
  52.         If listRef.itemData(i) = intCodigo Then
  53.             dameIndiceList = i
  54.         End If      
  55.     Next
  56.    
  57. End Function
  58.  
  59. --------------------------------------------------------------------------------------
  60.  
  61. private Function dameIndiceCombo (comboRef as Listbox, intCodigo as Integer) as Integer
  62. Dim i as Integer
  63.  
  64.     For i=0 To comboRef.ListCount - 1
  65.         If comboRef.itemData(i) = intCodigo Then
  66.             dameIndiceCombo = i
  67.         End If      
  68.     Next
  69.    
  70. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement