elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: ¿Eres nuevo? ¿Tienes dudas acerca del funcionamiento de la comunidad? Lee las Reglas Generales


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  vb consultar por fecha archivo secuencial
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: vb consultar por fecha archivo secuencial  (Leído 1,592 veces)
corlo

Desconectado Desconectado

Mensajes: 98


Ver Perfil
vb consultar por fecha archivo secuencial
« en: 21 Marzo 2015, 13:40 pm »

Hola soy corlo

tengo un problema a la hora de consultar por fecha en archivo secuencial, me lee todo el fichero, solo tiene que leer por fecha.
Guardar los datos lo hace bien





Código:

Este formulario es el de grabar datos lo hace perfecto.

Dim fecha As String
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 Sub Command1_Click()
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text2.SetFocus
End Sub

Private Sub Command2_Click()
Dim i As Integer
fecha = Text1.Text
nombre = Text2.Text
apellido = Text3.Text
producto = Text4.Text
cantidad = Text5.Text
precio = Text6.Text
total = Val(Text5.Text) * Val(Text6.Text)
Text7.Text = Val(Text5.Text) * Val(Text6.Text)
archivo = App.Path & "\ventas.txt"
Open archivo For Append As #1
Write #1, fecha, nombre, apellido, producto, cantidad, precio, total
For i = 0 To List1.ListCount - 1

        Print #1, List1.List(i)
        Next i
Close #1

End Sub



Este formulario es el de consula

Dim fe As String
Dim nom As String
Dim apel As String
Dim prod As String
Dim cant As Integer
Dim prec As Integer
Dim tot As Integer
Dim archivo As String
Private Sub Command1_Click()
Unload Me
Form1.Show
End Sub
Private Sub Command2_Click()
Text1.Text = ""
List1.Clear
Text1.SetFocus
End Sub


Private Sub Command3_Click()
List1.Clear
List2.Clear
Dim k As Integer
If Text1.Text = "" Then Exit Sub
fe = Format(Text1.Text, Date)
Text1.Text = fe
Text2.Text = nom
Text3.Text = apel
Text4.Text = prod
Text5.Text = cant
Text6.Text = prec
Text7.Text = tot
archivo = App.Path & "\ventas.txt"
Open archivo For Input As #1
If fe = Date Then
While Not EOF(1)
Input #1, fe, nom, apel, prod, cant, prec, tot
List1.AddItem fe & "        " & nom & "       " & apel & "      " & prod & "       " & cant & "      " & prec & "        " & tot

Wend
End If
Close #1

End Sub


Gracias


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Db o archivo secuencial????
Programación Visual Basic
_Sergi_ 1 1,754 Último mensaje 27 Febrero 2006, 14:11 pm
por WarGhost
Archivo Secuencial
Programación Visual Basic
YEXBOND007 1 1,980 Último mensaje 30 Abril 2007, 05:04 am
por Sancho.Mazorka
Lectura de archivo secuencial a acceso directo
Programación C/C++
josri 3 3,595 Último mensaje 16 Noviembre 2012, 02:14 am
por josri
Necesito consultar la fecha en Internet ??
.NET (C#, VB.NET, ASP)
TrashAmbishion 3 2,495 Último mensaje 15 Enero 2013, 01:32 am
por TrashAmbishion
archivo secuencial de texto a archivo for random aleatorio
Programación Visual Basic
corlo 1 2,453 Último mensaje 14 Enero 2016, 22:35 pm
por XresH
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines