[RESOLVED] help need for creating interface
Hello everybody....
I am very new to VB6 and more over belongs to Mechanical department...
can any one solve my problem?
Code:
Sub getMatrix()
Dim newFile As String
Dim i As Integer, j As Integer
fHndl = 1
Form1.ofd.Filter = "Text file (*.txt)|*.txt"
Form1.ofd.ShowSave
newFile = Form1.ofd.FileName
Open newFile For Output As fHndl
'Write #1, "File = " & swModel.GetPathName
Write #fHndl, "Components Used:::"
Write #fHndl, ""
For i = 1 To cnt
Write #fHndl, " ->" & strPart(i)
Next i
For i = 1 To cnt - 1
For j = i + 1 To cnt
Form2.Label1.Caption = strPart(i) & " - " & strPart(j)
Form2.Show
Next j
Next i
Close #fHndl
Shell "notepad.exe " & newFile, vbNormalFocus
End Sub
Sub writeMatrix()
Write #fHndl, " +x : " & Form2.Text1
Write #fHndl, " +y : " & Form2.Text2
Write #fHndl, " +z : " & Form2.Text3
Write #fHndl, " -x : " & Form2.Text4
Write #fHndl, " -y : " & Form2.Text5
Write #fHndl, " -z : " & Form2.Text6
Unload Form2
End Sub
Here strPart will get some part names from CAD file e.g.- part1, part2, part3, etc..... from that part names I have to form pairs(i am sure about what it called) like {part1, part2}, {part1,part3}, {part2,part3}.....etc.....
and for those pairs generated i have to give(input) six different integer vaalues in the form2..........i couldnt find the mistake in this code.........
pls anyone rectify the problem
with regards
BORAD
NITW
Re: help need for creating interface
I don't think we understand the problem, please be very specific: what is not happening and what should happen. You are not reading the file in the sample code you provided.
Let us know how strPart is declared and if ReDim'd please show us that line too.
Re: help need for creating interface
Quote:
I don't think we understand the problem, please be very specific: what is not happening and what should happen.
Me too... :(
Small suggestions about your code...
Code:
Sub getMatrix()
Dim newFile As String
Dim i As Integer, j As Integer
fHndl = FreeFile '~~~~~> Look Here
Form1.ofd.Filter = "Text file (*.txt)|*.txt"
Form1.ofd.ShowSave
newFile = Form1.ofd.FileName
Open newFile For Output As fHndl '~~~~~> Here, you are writing data to the file. Not inputting into the program. I think, you are using 'getMatrix' to read data from the file. ???
'Write #1, "File = " & swModel.GetPathName
Write #fHndl, "Components Used:::"
Write #fHndl, ""
For i = 1 To cnt
Write #fHndl, " ->" & strPart(i)
Next i
For i = 1 To cnt - 1
For j = i + 1 To cnt
Form2.Label1.Caption = strPart(i) & " - " & strPart(j)
Form2.Show '~~~~~> This will load the Form2 for each iteration of the loop. Is it necessary. Why don't you display the form after the loop
Next j
Next i
Close #fHndl
Shell "notepad.exe " & newFile, vbNormalFocus
End Sub
:wave:
Re: help need for creating interface
thanks for your reply...
I got the answer.... i can do now....... thanks once again....... and hope like this future too get help......
with regards
Borad
Re: help need for creating interface
Quote:
I got the answer.... i can do now.......
Glad to hear that.. :)
If your problem is solved, please mark the thread as Resolved :wave:
Re: [RESOLVED] help need for creating interface
For future reference I cannot see where you have declared cnt. This may be due to my poor eyesight and being a silly old goat but it is a very bad programming practice that will cause you many headaches and probably worse hair loss than I have. You should always use OPTION EXPLICIT in your projects. It will make your life much happier. :)