|
|
#1 |
|
New Member
Join Date: Nov 09
Posts: 5
![]() |
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
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 04:24 AM. Reason: added code tags |
|
|
|
|
|
#2 |
|
VBaholic & Loving It
Join Date: Oct 07
Location: GetWindowRect()
Posts: 7,895
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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.
__________________
Insomnia is just a byproduct of, "It can't be done" Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum. Read the HitchHiker's Guide to Getting Help on the Forums. {Memory Leak FAQ} {GDI+ Classes/Samples} {Unicode Open/Save Dialog} {Icon Organizer/Extractor} {VBA Control Arrays} {XP/Vista Manifest Creator} {UserControl Button Template} {stdPicture Render Usage} |
|
|
|
|
|
#3 | |
|
Engineering Student
Join Date: Jun 08
Location: Trivandrum, Kerala, India
Posts: 4,563
![]() ![]() ![]() |
Re: help need for creating interface
Quote:
![]() 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
__________________
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 (from the pull down menu - Thread Tools) ..::~^~ Akhilesh.B.Chandran ~^~::.. My system: AMD Athlon X2 5200+, ASUS Motherboard, 2 GB RAM, 400 GB HDD, Nvidia 8600 GT 512MB, 19.5" TFT(Wide), Creative 5.1 Home Theater Social Group: VBForums - Developers from India Last edited by akhileshbc; Nov 25th, 2009 at 05:30 AM. |
|
|
|
|
|
|
#4 |
|
New Member
Join Date: Nov 09
Posts: 5
![]() |
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 |
|
|
|
|
|
#5 | |
|
Engineering Student
Join Date: Jun 08
Location: Trivandrum, Kerala, India
Posts: 4,563
![]() ![]() ![]() |
Re: help need for creating interface
Quote:
![]() 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 (from the pull down menu - Thread Tools) ..::~^~ Akhilesh.B.Chandran ~^~::.. My system: AMD Athlon X2 5200+, ASUS Motherboard, 2 GB RAM, 400 GB HDD, Nvidia 8600 GT 512MB, 19.5" TFT(Wide), Creative 5.1 Home Theater Social Group: VBForums - Developers from India |
|
|
|
|
|
|
#6 |
|
Hyperactive Member
Join Date: Jun 07
Posts: 266
![]() |
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! |
|
|
|
![]() |
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|