•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 391,590 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,663 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser:
Views: 7229 | Replies: 7
![]() |
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 107
If I understand you correctly, you want to have a sequential file... that file will have a path in it, to a picture file, that you will load, is this correct?
Similarly, If You want to have 1 sequential file, with multiple paths (to different pictures), then you could read that into a collection as such:
If I'm way out in left field, then please elaborate your question, and I'll be happy to assist you in any further help that you need.
dim seqfile as string dim tmpvar as string open seqfile for input as #1 line input #1, tmpvar close #1 picture1.picture = tmpvar
Similarly, If You want to have 1 sequential file, with multiple paths (to different pictures), then you could read that into a collection as such:
dim xPaths as new collection dim seqfile as string dim tmpvar as string seqfile = "c:\somefile.dat" open seqfile for input as #1 do until eof(1) line input #1, tmpvar xPaths.Add tmpvar loop close #1
If I'm way out in left field, then please elaborate your question, and I'll be happy to assist you in any further help that you need.
•
•
Join Date: Feb 2005
Posts: 13
Reputation:
Rep Power: 4
Solved Threads: 0
I've found a way around that, which I think will be easier for the user. What I'm shooting for is a program where the user enters in the part number and clicks a button and this pulls the manufacturer and product description with a logo. The manager (I'm hoping) will write the information into the sequential file, or update it as necessary(which I'm told is frequently). Right now my code looks like this:
Private Sub cmdGetInfo_Click()
strProdNo = txtProdNo.Text
Do While Not EOF(1)
Input #1, co, part, dscr, ul
If strProdNo = part Then
lblDscrpt.Caption = dscr
lblCo.Caption = co
If ul = "UL1" Then
imgUL.Visible = True
Else
If ul = "UL2" Then
imgUL2.Visible = True
End If
End If
Else
lblDscrpt.Caption = "Not Found"
lblCo = " "
imgUL.Visible = False
imgUL2.Visible = False
End If
Loop
End Sub
With the code like this when I click the button to bring up the info. I get "Not Found"
So I moved the "Loop" to after "Input #1, co, part, dscr, ul"
This will find the last set of data in the Sequential file, but the first record brings up "Not Found"
I'm still playing around with thing, but any suggestions would be nice!
Thanks!
Private Sub cmdGetInfo_Click()
strProdNo = txtProdNo.Text
Do While Not EOF(1)
Input #1, co, part, dscr, ul
If strProdNo = part Then
lblDscrpt.Caption = dscr
lblCo.Caption = co
If ul = "UL1" Then
imgUL.Visible = True
Else
If ul = "UL2" Then
imgUL2.Visible = True
End If
End If
Else
lblDscrpt.Caption = "Not Found"
lblCo = " "
imgUL.Visible = False
imgUL2.Visible = False
End If
Loop
End Sub
With the code like this when I click the button to bring up the info. I get "Not Found"
So I moved the "Loop" to after "Input #1, co, part, dscr, ul"
This will find the last set of data in the Sequential file, but the first record brings up "Not Found"
I'm still playing around with thing, but any suggestions would be nice!
Thanks!
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 107
The INPUT has to be within the loop, in order to loop through the entire file. Also, if you have records AFTER the record that is actually found, that are not containing the part number in strProdNo, Then lblDscrpt and lblCo get set to Not found and nothing. So, Pretend that you have a file with:
Then The Captions Get Reset on the last line of the file, because it's not what you are looking for. You need to do 1 of two things here.... the best way is to beak out of the loop, before it finishes reading the file. So, Your code would look a little something like this:
I'm not sure if that will help or not.... drop a line and let me know. k?
not what you want not what you want what you want not what you want
Then The Captions Get Reset on the last line of the file, because it's not what you are looking for. You need to do 1 of two things here.... the best way is to beak out of the loop, before it finishes reading the file. So, Your code would look a little something like this:
Private Sub cmdGetInfo_Click() strProdNo = txtProdNo.Text Do While Not EOF(1) Input #1, co, part, dscr, ul If strProdNo = part Then lblDscrpt.Caption = dscr lblCo.Caption = co If ul = "UL1" Then imgUL.Visible = True exit do Else If ul = "UL2" Then imgUL2.Visible = True exit do End If End If Else lblDscrpt.Caption = "Not Found" lblCo = " " imgUL.Visible = False imgUL2.Visible = False End If Loop End Sub
I'm not sure if that will help or not.... drop a line and let me know. k?
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 107
•
•
Join Date: Feb 2005
Posts: 13
Reputation:
Rep Power: 4
Solved Threads: 0
Ok now I want the user to use a separate program to enter in the information that is read. I've entered in two sets of data to test. I can enter them in fine. They look all right in notepad, but when I run the program that is reading from the file. I get the input past end of file error or it will only read the last set of data entered. I know why I'm getting input past end of file error, there is an extra space after the last entry. I delete that and then it won't find the first entry.
If this isn't clear or you want my code email me
If this isn't clear or you want my code email me
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Visual Basic 4 / 5 / 6 Marketplace
•
•
•
•
access breach broadband code combo crime daniweb data data protection data transfer database drive dropdownlist files fix flash flv forensics government hard hardware hidden files hitachi how internet ip linux media microshaft microsoft module ms net news reuse security solve ssvichosst storage streaming terabyte video virus web wikipedia
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: vb and excel password and username
- Next Thread: Listbox with Columns



Linear Mode