-
Jul 23rd, 2017, 10:56 PM
#1
Thread Starter
New Member
[RESOLVED] Visual basic 6.0 : How to read from file
Hello,
I have a problem with below code.
My form will display Start time and End time for each trip.
However, although I already read travel times file, below coding didn't work.
Supposedly when End time stops at 1600, the data still display a result although it should stop at 1600.
Can someone help me?
Private Sub step1()
lunch = 1
If (Ktotal <= K) And (Ctotal <= C) Then
For i = 0 To row - 1
If Tvisited(i) = 0 Then
s = 0
data(s, 3) = Val(frmDays.txtStart.Text) * 60
data(0, 4) = Val(frmDays.txtEnd.Text) * 60
T = data(s, 3)
lunch = 0
dinner = 0
frmResult.picResult.Print " Itinerary: Day " & Ktotal;
frmResult.picResult.Print poi(s)
Exit For
End If
Next i
If lunch = 1 Then
frmResult.picResult.Print " Total cost: " & Ctotal & ","
frmResult.picResult.Print " Total number of destinations: " & Z & ","
frmResult.picResult.Print " THE TOUR PACKAGE IS COMPLETED"
Else
Call step2
End If
Else
frmResult.picResult.Print "Total cost: " & Ctotal & ","
frmResult.picResult.Print "Total number of destinations: " & Z & ","
frmResult.picResult.Print "THE TOUR PACKAGE IS COMPLETED"
End If
End Sub
-
Jul 24th, 2017, 05:53 AM
#2
Re: Visual basic 6.0 : How to read from file
Can't tell much by what is posted. No idea what may have been in the file nor how it was read also no idea where 1600 comes into play. Nothing there jumps out as related to either of those. All I can see is that it is looping through and array and printing some stuff.
That said if you expect it to stop when it gets to 1600 should you maybe have an if test in your loop that exits the loop when it gets a value of 1600?
-
Jul 24th, 2017, 07:40 AM
#3
Re: Visual basic 6.0 : How to read from file
1. What a confusing subroutine.
2. Do you have Option Explicit in your Declarations?
3. Where is 'row' set?
4. What is the array Tvisited?
5. I can make not heads nor tails of what you have here, or even what you are trying to do...and this code doesn't seem to reflect anything about the title of your Thread. Maybe you should attach your project (zipped up of course) so we can try to figure out this mess.
-
Jul 26th, 2017, 02:58 AM
#4
Thread Starter
New Member
Re: Visual basic 6.0 : How to read from file
Originally Posted by misaghah007
Hello,
I have a problem with below code.
My form will display Start time and End time for each trip.
However, although I already read travel times file, below coding didn't work.
Supposedly when End time stops at 1600, the data still display a result although it should stop at 1600.
Can someone help me?
Private Sub step1()
lunch = 1
If (Ktotal <= K) And (Ctotal <= C) Then
For i = 0 To row - 1
If Tvisited(i) = 0 Then
s = 0
data(s, 3) = Val(frmDays.txtStart.Text) * 60
data(0, 4) = Val(frmDays.txtEnd.Text) * 60
T = data(s, 3)
lunch = 0
dinner = 0
frmResult.picResult.Print " Itinerary: Day " & Ktotal;
frmResult.picResult.Print poi(s)
Exit For
End If
Next i
If lunch = 1 Then
frmResult.picResult.Print " Total cost: " & Ctotal & ","
frmResult.picResult.Print " Total number of destinations: " & Z & ","
frmResult.picResult.Print " THE TOUR PACKAGE IS COMPLETED"
Else
Call step2
End If
Else
frmResult.picResult.Print "Total cost: " & Ctotal & ","
frmResult.picResult.Print "Total number of destinations: " & Z & ","
frmResult.picResult.Print "THE TOUR PACKAGE IS COMPLETED"
End If
End Sub
This is the full coding
vb_Langkawi_Original.zip
-
Jul 26th, 2017, 05:41 AM
#5
Re: Visual basic 6.0 : How to read from file
Well that was about as helpful as a screen door on a submarine!
WHAT is this thing supposed to do?
1-You have NOT included Option Explicit. Without that, I'm not even going to attempt to figure out what you are doing.
2. You give no comments in your code as to what it is supposed to do, nor any explanation in this thread.
Sorry, but I'm backing out....I don't have the time to work this one....I'll let someone else take over (if they dare).
Sam
-
Jul 27th, 2017, 02:55 AM
#6
Thread Starter
New Member
Re: Visual basic 6.0 : How to read from file
Originally Posted by SamOscarBrown
Well that was about as helpful as a screen door on a submarine!
WHAT is this thing supposed to do?
1-You have NOT included Option Explicit. Without that, I'm not even going to attempt to figure out what you are doing.
2. You give no comments in your code as to what it is supposed to do, nor any explanation in this thread.
Sorry, but I'm backing out....I don't have the time to work this one....I'll let someone else take over (if they dare).
Sam
Hi Sam,
Sorry if confuse you with coding .
I mention it earlier I am new to coding with VB.
That is why I joined this forum to get help.
The thing is our time zone is different,
Apology again if i pissed you off with my coding.
Thanks for your time downloading the coding and make comments.
I will try to look for another source .
I will close this thread as solved.(Because I cant find ways to delete this thread).
Thanks.
-
Jul 27th, 2017, 05:45 AM
#7
Re: [RESOLVED] Visual basic 6.0 : How to read from file
All you did after being asked questions was to quote your own post.
Your question supposedly is about reading a file but the code posted does nothing of the sort.
Rather than closing the thread and looking for another source you should provide info required to help solve your problem
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|