1
« en: Jueves 26 de Marzo de 2015, 10:40 »
Porque no utilizas este sistema?
Dim fecha As Date
Dim nombre As String
Dim apellido As String
Dim producto As String
Dim cantidad As Integer
Dim precio As Integer
Dim total As Integer
Dim archivo As String
Private mcIni As clsIni
Dim INI_PATH As String
Dim sSeccion As String
Private Sub Command1_Click()
'nuevo
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text2.SetFocus
End Sub
Private Sub Command2_Click()
' guarda los datos
sSeccion = Text1.Text
INI_PATH = App.Path & "\Ventas.ini"
With mcIni
Call .writeValue(INI_PATH, sSeccion, "Fecha", Text1.Text)
Call .writeValue(INI_PATH, sSeccion, "nombre", Text2.Text)
Call .writeValue(INI_PATH, sSeccion, "apellido", Text3.Text)
Call .writeValue(INI_PATH, sSeccion, "producto", Text4.Text)
Call .writeValue(INI_PATH, sSeccion, "cantidad", Text5.Text)
Call .writeValue(INI_PATH, sSeccion, "precio", Text6.Text)
total = Val(Text5.Text) * Val(Text6.Text)
Call .writeValue(INI_PATH, sSeccion, "total", total)
End With
End Sub
Private Sub Command3_Click()
' Recuperar los datos
sSeccion = Text1.Text
INI_PATH = App.Path & "\Ventas.ini"
Text1 = mcIni.getValue(INI_PATH, sSeccion, "Fecha")
Text2 = mcIni.getValue(INI_PATH, sSeccion, "nombre")
Text3 = mcIni.getValue(INI_PATH, sSeccion, "apellido")
Text4 = mcIni.getValue(INI_PATH, sSeccion, "producto")
Text5 = mcIni.getValue(INI_PATH, sSeccion, "cantidad")
Text6 = mcIni.getValue(INI_PATH, sSeccion, "precio")
End Sub
Private Sub Form_Load()
Set mcIni = New clsIni
Text1.Text = Date
End Sub