Results 1 to 13 of 13

Thread: A few MORE questions........

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2000
    Posts
    64

    Arrow

    I have a few more questions. I am using Visual Basic 4 Standard.

    1) I have a line of code like this in my program,
    Code:
    Print #I, Form1.league, Form1.standings, Form1.race, Form1.racedate, Form1.name01, Form1.name02, Form1.name03, Form1.name04, Form1.name01, Form1.name02, Form1.name03, Form1.name04, Form1.name05, Form1.name06, Form1.name07, Form1.name08, Form1.name09, Form1.name10, Form1.name11, Form1.name12, Form1.name13, Form1.name14, Form1.name15, Form1.name16, Form1.name17, Form1.name18, Form1.name19, Form1.name20, Form1.name21, Form1.name22, Form1.name23, Form1.name24, Form1.name25, Form1.name26, Form1.name27, Form1.name28, Form1.name29, Form1.name30, Form1.name31, Form1.name32
    Is there any way to put this on more than one line? (Eg, word wrap)


    2) I am using the following code to save information from text boxes to a .txt document.

    Code:
    Private Sub Command1_Click()
    Text1 = Text1 + Text2
    For I = 1 To 1
        filename = (Text1)   ' Create filename.
        Open (Text1) For Output As #I  ' Open file.
        Print #I, Form1.league, Form1.standings, Form1.race, Form1.racedate, Form1.name01, Form1.name02, Form1.name03, Form1.name04, Form1.name01, Form1.name02, Form1.name03, Form1.name04, Form1.name05, Form1.name06, Form1.name07, Form1.name08, Form1.name09, Form1.name10, Form1.name11, Form1.name12, Form1.name13, Form1.name14, Form1.name15, Form1.name16, Form1.name17, Form1.name18, Form1.name19, Form1.name20, Form1.name21, Form1.name22, Form1.name23, Form1.name24, Form1.name25, Form1.name26, Form1.name27, Form1.name28, Form1.name29, Form1.name30, Form1.name31, Form1.name32
        ' Write string to file.
    Close   ' Close open files.
    Next I
    Text1 = ""
    Form5.Visible = False
    End Sub
    How do I set a default directory for this to be saved in? I want it to go into the install directory of the user (the folder where they chose to install the program)


    3) I would like to load a text document which was saved into the proper text boxes.

    I am using the code above to save, and was wondering how to make it so the text loads into the proper text boxes.

    A screenshot of the form is below:
    http://www.homestead.com/wrestlecarr...ngscarsdir.jpg

    The code above is only for the first column of the left hand side of the form (name). How can I load the text document into this so it places the proper names into the boxes?

    Any help is greatly appreciated

    Thank You
    Wrestlecar

  2. #2

    Exclamation HARD

    This is a realy hard code, well not to hard but
    try mailing one of the programmers on Visual Basic World!
    My only advice

  3. #3
    Guest
    ok, for a start use the With...end with statement to squash it down a bit.

    Next i suggest creating an array for all the form1.nameXX values so it would look like this Form1.Name(XX), then you could use a loop to do each one without having to name them all, plus it will execute faster.

    if you have a long line of commands use a space and an underscore to cut it up like this...


    Form1.name01, Form1.name02, _
    Form1.name03, Form1.name04, _
    ...
    ...
    ...

    #############

    for your second question, that For I = 1 to 1 is totally pointless.

    open a file like this:
    Code:
    I = freefile
    Open MyFileName for Output as #I
    'do your stuff here
    Close #I
    plus the directory that the application is installed in can be found using App.Path (read only)

    [Edited by wossname on 05-06-2000 at 08:25 PM]

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2000
    Posts
    64

    Wink

    That code worked fine for the save routine, but how do I make it save to a specified directory. (App Path)

    I am kind of new to this.

    THanks

  5. #5
    Guest

    that's OK

    you need to be careful when using App.path because it doesnt put the "\" on the end of the path

    so to save to the proper path...

    Code:
    open (App.path & "\" & MyFileName) for output as #I
    the "&" is a concatenation operator (it glues strings together)

    hows that?



    [Edited by wossname on 05-06-2000 at 08:56 PM]

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Apr 2000
    Posts
    64
    Thank you..

    My second and 1st questions are now answered..

    I think the thrid one may be a little harder.

  7. #7
    Guest
    Hello,

    I have few things to say:

    UDT used to store your data
    Put used for saving the data to a file
    Get used to load the data from a file

    I can build a small app to demonstrate these but you could also look in the help files.

    These three items will fix all of your problems.

    Let me know if you want me to build that demo.

    Best

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Apr 2000
    Posts
    64
    Could you please?
    I have searched through those help files and the ones on this site, and have found them all the same.

    Thanks

  9. #9
    Guest
    Already started working on it

    When I get it finished I will post a link to the files

    Best

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Apr 2000
    Posts
    64

    Smile

    Thank You

  11. #11
    Guest
    Ok I'm done

    If you need me to comment the app let me know and I will do that in the morning. To tired now.

    Here is the URL to get the file

    http://home.epix.net/~rvasva/flatfile01.zip

    If you anything explained just let me know.

    Best,


  12. #12

    Thread Starter
    Lively Member
    Join Date
    Apr 2000
    Posts
    64
    That program works good, and i like the idea of saving it to a dat file.

    A few questions though. How could i use this in my program ( a screenshot link in in an earlier post) because I dont really understand some of the coding you used.

    I like the print command, i have to figure that one out too.

    With this dat file, is is possible to to have more than one saved at a time, and the user can choose to load one or create a new one?

  13. #13
    Guest
    Hello again,

    Ok the first thing I'm going to do is to open a new thread, as this is hard to work with. Very long lines of code

    I'll open it as:

    A few MORE questions........ Part 2

    See you there.


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