|
-
Nov 24th, 2009, 01:00 AM
#1
Thread Starter
New Member
[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
Last edited by si_the_geek; Nov 24th, 2009 at 05:24 AM.
Reason: added code tags
-
Nov 24th, 2009, 08:45 AM
#2
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.
-
Nov 25th, 2009, 06:26 AM
#3
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.
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
Last edited by akhileshbc; Nov 25th, 2009 at 06:30 AM.
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Nov 25th, 2009, 02:09 PM
#4
Thread Starter
New Member
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
-
Nov 25th, 2009, 10:29 PM
#5
Re: help need for creating interface
I got the answer.... i can do now.......
Glad to hear that.. 
If your problem is solved, please mark the thread as Resolved
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Dec 5th, 2009, 01:51 PM
#6
Hyperactive Member
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.
Slower than a crippled Vista
More buggy than a fresh XP install
Look! Down the road, some 50 miles behind the drunken snail.
It's Ubuntu!
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
|