\r\n\r\n
Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > File I/O and Registry > Ive made a mess of dislpaying informtaion from 2 files simultaneously


\r\n \r\n
 
 
Thread Tools Display Modes

\r\n\r\n\r\n
Hello! I\'m fairly rudimentary at the programming could someone please help me with this!
\r\nI have two files "cars.txt" and "customers.txt" And upon pressing find car a loop will try to match a registration in "cars.txt" If a match is found then I want to display the information from the two files in labels.
\r\nI have had trouble combining the two files and the code doesnt work possibley due to bad ordering? Could someone please follow me through this.
\r\n
\r\nPrivate Sub regfind()
\r\n\'this is where i search thecustomers that came before. If the registration is not found then show a message box saying "add new customer" then set target to new registration. If the registration was found then display all details in a label. Also validate
\r\n
\r\n foundcar = False
\r\n fn = FreeFile()
\r\n Open "N:\\my pictures/cars.txt" For Input As #1
\r\n Open "N:\\my pictures/customers.txt" For Input As #fn
\r\n Do While Not EOF(1) And Not foundcar
\r\n Input #1, registration, cartype, company, typecode, lsdate
\r\n Do While Not EOF(2)
\r\n Input #2, custname, address, town, postcode, telephone
\r\n If txtcustomercarreg = registration Then
\r\n foundcar = True
\r\n lbltyretype = "Tyre-type Code: " & typecode
\r\n lblcartype = "Car Manufacturer: " & cartype
\r\n lblcompname = "Customer Name: " & company
\r\n lblregs = "for registration " & registration
\r\n lblls = "LastService date: " & lsdate
\r\n End If
\r\n Loop
\r\n If company = custname Then
\r\n
\r\n lbladdress = "Address: " & address & ", " & town
\r\n lblpostcode = postcode
\r\n lbltelephone = "Telephone: " & telephone
\r\n End If
\r\n Loop
\r\n Close #fn
\r\n
\r\n If Not foundcar Then
\r\n MsgBox "REGISTRATION NOT FOUND" & Chr$(10) & "Please check or add new car to the database", vbExclamation + vbOK, "Registration not found"
\r\n
\r\n
\r\n End If
\r\n \r\n\r\n
\r\n \r\n\r\n \r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n
\r\n \r\n \r\n \r\n \r\n Reply With Quote\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n \r\n\r\n
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n'; pd[725977] = '\r\n\r\n \r\n\r\n
\r\n
\r\n
\r\n\r\n
\r\n \r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n \r\n
\r\n
\r\n  \r\n #2  \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n \r\n Old\r\n \r\n 04-23-2004, 01:51 PM\r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n
Gruff\'s Avatar\r\n\r\n
\r\n \r\n Gruff\r\n Gruff is offline\r\n\r\n\r\n
Prev Previous Post   Next Post Next
  #1  
Old 04-23-2004, 04:02 AM
zoec zoec is offline
Newcomer
 
Join Date: Mar 2004
Posts: 11
Default Ive made a mess of dislpaying informtaion from 2 files simultaneously


Hello! I'm fairly rudimentary at the programming could someone please help me with this!
I have two files "cars.txt" and "customers.txt" And upon pressing find car a loop will try to match a registration in "cars.txt" If a match is found then I want to display the information from the two files in labels.
I have had trouble combining the two files and the code doesnt work possibley due to bad ordering? Could someone please follow me through this.

Private Sub regfind()
'this is where i search thecustomers that came before. If the registration is not found then show a message box saying "add new customer" then set target to new registration. If the registration was found then display all details in a label. Also validate

foundcar = False
fn = FreeFile()
Open "N:\my pictures/cars.txt" For Input As #1
Open "N:\my pictures/customers.txt" For Input As #fn
Do While Not EOF(1) And Not foundcar
Input #1, registration, cartype, company, typecode, lsdate
Do While Not EOF(2)
Input #2, custname, address, town, postcode, telephone
If txtcustomercarreg = registration Then
foundcar = True
lbltyretype = "Tyre-type Code: " & typecode
lblcartype = "Car Manufacturer: " & cartype
lblcompname = "Customer Name: " & company
lblregs = "for registration " & registration
lblls = "LastService date: " & lsdate
End If
Loop
If company = custname Then

lbladdress = "Address: " & address & ", " & town
lblpostcode = postcode
lbltelephone = "Telephone: " & telephone
End If
Loop
Close #fn

If Not foundcar Then
MsgBox "REGISTRATION NOT FOUND" & Chr$(10) & "Please check or add new car to the database", vbExclamation + vbOK, "Registration not found"


End If
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The next step ... imbedding files Juanita General 5 06-26-2002 04:39 PM
Required files burningodzilla General 11 09-12-2001 04:51 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->