Results 1 to 6 of 6

Thread: [RESOLVED] help need for creating interface

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    5

    Resolved [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

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    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.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    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,...

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2009
    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. #5
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    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,...

  6. #6
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    280

    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
  •  



Click Here to Expand Forum to Full Width