```
Private Sub Command1_Click()
Dim a, b, cc As Integer
Dim p(3), d(3), e(3), t(3), h(3), w(3), c(3), f(6) As Integer
If Text4.Text <> "" Then
strfile = Text4.Text
Open strfile For Input As #1
For i = 1 To 3
Input #1, p(i), d(i), h(i), w(i)
Next i
Close #i
For i = 1 To 3
p(i) = CInt(InputBox("enter pros.tj " & CStr(i), "prosseng time for job"))
d(i) = CInt(InputBox("enter due date " & CStr(i), "due date for job"))
h(i) = CInt(InputBox("enter cost ear " & CStr(i), "cost of earlness"))
w(i) = CInt(InputBox("enter weigh " & CStr(i), "weigh of job"))
Next i
Open "c:\machineporb.text" For Output As #2
For i = 1 To 3
Print #2, p(i); d(i); h(i); w(i)
Next i
Close #2
End If
For i = 1 To 3
c(i) = 0
e(i) = 0
t(i) = 0
Next i
For i = 1 To 3
If i <> 1 Then c(i) = c(i - 1) + p(i)
If i = 1 Then c(i) = p(i)
Next i
For i = 1 To 3
If (d(i) - c(i)) > 0 Then
e(i) = d(i) - c(i)
If (c(i) - d(i)) > 0 Then
t(i) = c(i) - d(i)
Next i
a = 10
For i = 1 To 3
f(i) = h(i) * (d(i) - p(i))
If f(i) < a Then
a = f(i)
Text1.Text = CStr(i)
End If
Next i
a = f(1) + (h(2) * e(2)) + (w(2) * t(2))
b = f(2) + (h(1) * e(1)) + (w(1) * t(1))
If a > b Then f(4) = b
If b > a Then f(4) = a
a = f(1) + (h(3) * e(3)) + (w(3) * t(3))
b = f(3) + (h(1) * e(1)) + (w(1) * t(1))
If a > b Then f(5) = b
If b > a Then f(5) = a
Text2.Text = "12"
a = f(2) + (h(3) * e(3)) + (w(3) * t(3))
b = f(3) + (h(2) * e(2)) + (w(2) * t(2))
If a > b Then f(6) = b
If b > a Then f(6) = a
a = f(4) + (h(3) * e(3)) + (w(3) * t(3))
b = f(5) + (h(2) * e(2)) + (w(2) * t(2))
cc = f(6) + (h(1) * e(1)) + ((w1) * t(1))
If (b > a) And (cc > a) Then f(7) = a
Text3.Text = "213"
If (a > b) And (cc > b) Then f(7) = b
Text3.Text = "321"
If (cc > b) And (a > cc) Then f(7) = cc
Text3.Text = "123"
If b > a Then f(6) = a
End Sub
Private Sub Command2_Click()
st = InputBox("åá ÊÑíÏ ÍÝÙ ÇáÈíÇäÇÊ")
Open st For Output As #1
Open "c:\machineprob.txt" For Input As #2
While Not EOF(2)
Input #2, st
Print #1, st
End While
Close()
MsgBox("Êã ÇáÍÝÙ")
End Sub
```

maytham
0
Newbie Poster

## Recommended Answers

Jump to PostLook at lines 32-37. You open two If blocks but don't close them with End If.

Please use the

Codetool to insert code so that it gets properly formatted. I fixed it for you (this time).

Jump to Postbtw in line 10 I think you mean

`Close #1`

Jump to PostAs Jim said, 2 If statements opened, never closed...

## All 12 Replies

maytham
0
Newbie Poster

Cimpery
0
Newbie Poster

Reverend Jim
3,627
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster

tinstaafl
1,161
Posting Maven

AndreRet
381
Senior Poster

maytham
0
Newbie Poster

maytham
0
Newbie Poster

Reverend Jim
3,627
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster

tinstaafl
1,161
Posting Maven

maytham
0
Newbie Poster

Cimpery
0
Newbie Poster

maytham
0
Newbie Poster

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.