Results 1 to 36 of 36

Thread: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    1

    Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Pre-Sorry. Didn't know the Title box meant subject of post. Bad me for two identical posts on one day
    Sorry, but I always said "The only dumb question is the one you don't ask."
    I was medically retired from the Air Force, and am now unemployable. But I found a way to continue to contribute by designing a program to generate random practice tests for Air Force NCOs to study, to prepare for promotion testing. My database is a 400-question, (multiple-guess) text file, and I have written a good program to generate 4 different 100-question tests. (The logic and program flow from the old GW-BASIC adapted nicely.) However, the ONLY thing I cannot figure out is how to display the formatted questions on the screen, in a form, or in a separate window, or whatever. The questions will appear just like you would expect, with buttons to push to select the answer, and then a NEXT button to move on.

    Can anyone help me display the questions, one at a time, as mentioned above? I have created a Form, named QUESTION, but have not been able to put anything in it, even with all the "help" methods found on other web sites.

    This project would really help me feel like I can still contribute. Let me know of any ideas, please.

    Ronald R. Davis, SMSgt, USAF (Ret)

  2. #2
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Ron

    Welcome to the Forums

    What does the text file look like?
    1. One line per question, comma separated with the multiple choices?
    2. One line for a question, followed by indented lines for the multiple choices?
    3. Something else?

    Perhaps you could show the first few lines of your text file.

    Spoo

  3. #3
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    You can probably just use Label controls to display your text. See the simple demo attached.
    Attached Files Attached Files

  4. #4
    Junior Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    20

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Had to re-register, don't know why.
    Anyways, the text file structure is irrelevant, but since you asked, Each question has a possible 9 lines of TEXT, which are strings telling the TQ Number, Stem1, Stem2, Stem2, ANSA, ANSB, ANSC1, ANSC2, and KEYRAT. I have already got a way to pull them from the file into the appropriate variables, so no biggie there.

    What I really need is a way to put them, one question at a time, into a box, window, form, or whatever. Initially, I just need to step through the database to see if there are any weird things or delimiters that I missed. Then, I can easily format for student use, and add buttons for answer selection and "NEXT QUESTION" stuff.

    I've tried everyone's ideas and all should work. I think I am missing some declaration at the top of the program to enable this stuff.

  5. #5
    Junior Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    20

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Sorry. The above post should read "exactly 9 lines of TEXT, which are strings..." And the second Stem2 is Stem3. But since I might have room here, the first TQ would be in the file like this:
    “101”
    “The first successful, and useful, balloon reconnaissance mission for the”
    “Army occurred during:”
    “”
    “(a)The War of 1812”
    “(b)The Civil War”
    “(c)The Spanish-American War”
    “”
    “(b)AFPAM36-2241 (Oct 2011) – Paragraph 2.2.1”
    Ron

  6. #6
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Ron

    Here is one possible way to go

    1. dump the text file into an array .. I'm thinking of a 2-D arrary aQuiz(400, 9)
    2. populate a multi-line textbox with the 1st "row" -- ie, aQuiz(1, 1) to aQuiz(1, 9)
    3. click a button, increment a counter by 1 (ie, to 2)
    4. clear the textbox, and populate with 2nd "row" -- ie, aQuiz(2 1) to aQuiz(2 9)
    ,, and so on.

    Here is a code snippet to dump the text file into an array

    You'll need something like this in declarations
    Code:
    Dim aQuiz(400, 9) As String
    Then this sub will populate the array
    Code:
    Sub Quiz()
        '
        fn = "c:\myDirectory\test1.txt"
        Close #1
        Open fn For Input As #1
        nn = 1
        For ii = 1 To 400 * 9
            Line Input #1, xtr
            resu = ii Mod 9
            ee = IIf(resu = 0, 9, resu)
            ' populate array
            aQuiz(nn, ee) = xtr
            ' increment counter
            nn = IIf(resu = 0, nn + 1, nn)
        Next ii
        Close #1
    End Sub
    Can you take it from here?

    Spoo

  7. #7
    Junior Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    20

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Spoo
    I hadn't thought of the MOD operator in almost 30 years. It was a fun way to do stuff.
    But, I got a "Wrong number of arguments or invalid property assignment" message.
    Regardless, even when I get a good compile with no errors, all I get is a big Form labeled "Question" <-- EMPTY!
    The use of labels sounds promising, but I can't find code examples anywhere which shows me how to set up a lable
    in any way, shape, or form, let alone put something in it.

    None of my VB5 books go into command syntax, and the HELP file doesn't either.
    Thanks for your input. Brought back good memories.
    Now I just have to my results on the screen.
    Ron

  8. #8
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Ron

    Maybe try something like this.

    1. Add a TextBox, named Text1. Be sure to set the MultiLine Property = True
    2. Add a CommandButton named cbNEXT
    3. Add this in the Declarations
    Code:
    Dim aQuiz(400, 9) As String
    Public nnQuiz As Integer
    4. Add this to the sub in which you populated aQuiz. It will size the textbox and show the 1st question
    Code:
        With Text1
            .Top = 1000
            .Left = 200
            .Width = 8000
            .Height = 2300
            .Text = Empty
            For ii = 1 To 9
                .Text = .Text + aQuiz(1, ii) + vbCrLf
            Next ii
            nnQuiz = 1
        End With
    5. Add this sub. It will update the TextBox with the next question each time you click it.
    Code:
    Private Sub cbNEXT_Click()
        '
        nnQuiz = nnQuiz + 1
        With Text1
            .Text = Empty
            For ii = 1 To 9
                .Text = .Text + aQuiz(nnQuiz, ii) + vbCrLf
            Next ii
        End With
        '
    End Sub
    Spoo

  9. #9
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Ron

    To add a TextBox control ,,,

    1. Be sure that you can see your Form .. if you can't, click View > Object
    2. Click the Toolbox icon on the menu bar of the editor. It looks like an "X" ,, hammer and wrench
    3. The Toolbox will appear on the left.
    4. Move your mouse over the available controls. One with an "ab" is the TextBox control.
    5. Click it, then move your mouse to the form. A + will appear. Mouse-down and drag down, to the right
    6. A TextBox control has just been added to your Form.
    7. Now, a few Properties need to be set.
    8. Right-click on the TetxBox, and click Properties. A Properties Window will appear.
    9. About half-way down the list, you'll see MultiLine. It defaults to False. Change the value to be True

    You can do the same thing to add a CommandButton (or any other control, for that matter)
    Hope that helps

    Spoo

  10. #10
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,622

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Is this kinda what you want?

    Attachment 99639

    This is a sample page from a game program I wrote awhile ago.....obviously, where you see the 'question', your multiline text box would need to be a bit larger in height.

    I use a MS Access database holding the qs and a's (along with which is the correct answer). If you would like to see this code, I'll gladly upload or email to you.

  11. #11
    Junior Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    20

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Spoo;
    I got the box, assigned Multiline, and I got the button, labeled it "Next" Both look good, but still nothing is going inside the TextBox, which in my case is named "Question".
    The compiler stops at the first .Test and says "Method or data member not found."
    Thanks again.
    Ron

  12. #12
    Junior Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    20

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Spoo;
    Just a sidebar thing. If you would like to see the tests in WORD format, with answer sheets and Key sheets, I have them posted on a Facebook page named NCO PME. My goal is to put this program up there so NCOs can take the test online, get their score, and to a test review. As it is now, each test is 20 pages long so that's not cool.
    Airmen and NCOs all over the world are screaming for something like this. Since I used to do this at the Academy, I'm pretty good at it. Now I just need to get my program to be visible to them on their computers.
    Ron

  13. #13
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,622

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Guess my suggestion was not what you want.
    If you want to to this on the Net, so it can be an on-line thing, VB6 may not be your best option. ASP, VB.NET, and even stuff like the old FrontPage work well for on-line tests. I imagine VB.NET might be your best option.
    Building a VB6 app with your type of database is easy for standalone (and local networks) systems, however, if you really want to go world-wide (at least US wide) and reach those NCOes, then look into creating quizzes on web pages. I used to do this all the time using the old FrontPage (which is no longer supported and I can't even get to run on anything past an XP machine). But, from what I hear, Visual Studio .NET has a great capability for doing this sort of thing.

  14. #14
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Ron

    Did you happen to utilize my approach shown in post #6 which populates the array aQuiz?
    If so, could you post the code here. It might be that the array is not getting populated properly.

    To post the code here, start your post as you usually do, and include your code snippet
    Then, press the Go Advanced button at the lower right corner of the Quick Reply window.
    You will see more formatting buttons, in particular, a # button near the end of row 2.

    It will wrap a set of [Code] flags around your code.
    To do that, select your code (ie, highlight it .. drag your mouse from the beginning of your
    code to the end of it), then click the # button.

    This will enable us to start trouble-shooting your issue.

    Spoo

  15. #15
    Junior Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    20

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Sam,
    Thanks for the input, but unless I can get if for free, with all the reference books, it's not gonna happen. All I have is a good computer, a lot of time and experience. But I'm stuck with the sofftware I currently own. Hell, I can't even afford upgrades.
    Regarding, putting it online, I figure I could just put all the files in one folder, and upload the whole folder to facebook. My docs there show up just fine, but I'm hoping to put an interactive version there so they don't have do download and print 20 pages or WORD documents per test. Thanks for you input. Just noticed, my reply to you did not post. I figure I could adapt it to suit my needs. Emails are [email protected] and [email protected]. Thanks again, Ron

  16. #16
    Junior Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    20

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Label.AutoSize = True
    fn = "PFETESTBASELINE.txt"
    Close #1
    Dim TQNum(400) As String
    Open fn For Input As #1
    nn = 1
    For ii = 1 To 400 * 9
    Line Input #1, xtr
    resu = ii Mod 9
    ee = IIf(resu = 0, 9, resu)
    PFETest(nn, ee) = TQNum(ii)
    nn = IIf(resu = 0, nn + 1, nn)
    Next ii
    Close #1

  17. #17
    Junior Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    20

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Spoo,
    That last one was an answer to you, but the paste stepped on your name.
    Compiled with no errors, but still no display.
    Ron

  18. #18
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Ron

    I've taken the liberty to show your code using the [Code] wrappers ...
    Code:
    Label.AutoSize = True fn = "PFETESTBASELINE.txt" Close #1 Dim TQNum(400) As String Open fn For Input As #1 nn = 1 For ii = 1 To 400 * 9 Line Input #1, xtr resu = ii Mod 9 ee = IIf(resu = 0, 9, resu) PFETest(nn, ee) = TQNum(ii) nn = IIf(resu = 0, nn + 1, nn) Next ii Close #1
    I see a few issues here.

    1. How the Line Input statement works
      • Each time it is executed in the loop, it assigns one line from your text file to the variable
      • I happened to use the variable name of xtr (which stands for "extract")
      • You have it here. However, you don't ever subsequently seem to utilize it !!
    2. Your 2-D array is named PFETest .. fine
      • You seem to be populating it with TQNum(ii)
      • You Dim'd TQNum(400) .. fine, but so far, it will be "empty"
      • So, when you assign PFETest(nn, ee) = TQNum(ii), PFETest(nn, ee) will also be empty


    I'd suggest the following change
    Code:
    Label.AutoSize = True fn = "PFETESTBASELINE.txt" Close #1 Dim TQNum(400) As String Open fn For Input As #1 nn = 1 For ii = 1 To 400 * 9 Line Input #1, xtr resu = ii Mod 9 ee = IIf(resu = 0, 9, resu) PFETest(nn, ee) = xtr nn = IIf(resu = 0, nn + 1, nn) Next ii Close #1
    BTW, here is a screen-shot of what I was aiming for.

    Name:  Ron.JPG
Views: 525
Size:  19.7 KB

    Granted, this is not expected to be your final approach.

    Rather, it is intended to display your text file, or more specifically, your
    array PFETest(400, 9), 9 lines at a time, so you can "proof-read" it.

    Spoo
    Last edited by Spoo; May 1st, 2013 at 09:34 AM.

  19. #19
    Junior Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    20

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Spoo;
    Believe it or not, your screen shot is exactly what I need at first. Once I go through the whole testbank and see that each line is "legal" and that I have exactly 9 lines per TQ, I can set it up to accept student responses (A,B,C buttons and NEXT and maybe later a BACK button).
    But something else is wrong. My text box comes up centered on the form with only "Text1" in the upper left corner. The form is named Question and I do have a NEXT button centered below the text box.
    I can't believe I actually was good at this stuff. Cracking your skull from 3 stories up causes some memory loss. Thanks again

  20. #20
    Junior Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    20

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Spoo;
    Just had an idea. What are the property values supposed to be for the textbox, Test1" Maybe mine are preventing me from writing in the box.
    Ron

  21. #21
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Ron

    OK, glad my screenshot is what you are after for proof-reading purposes.
    But, apparently, your textbox is still NOT getting any data.

    First thing to check .. is the array PFETest being populated?
    To do this, I'd like you to set a breakpoint here

    Code:
    Label.AutoSize = True
    fn = "PFETESTBASELINE.txt"
    Close #1
    Dim TQNum(400) As String
    Open fn For Input As #1
    nn = 1
    For ii = 1 To 400 * 9
        Line Input #1, xtr
        resu = ii Mod 9
        ee = IIf(resu = 0, 9, resu)
        PFETest(nn, ee) = xtr
        nn = IIf(resu = 0, nn + 1, nn)
    Next ii
    Close #1
    A breakpoint will cause the program to stop and enable you to "check" things

    1. To create the breakpoint, at the grey margin at the left of that line, click in the grey margin.
    2. A dot should appear (in my case, it is brown).
    3. OK, that will "set" the breakpoint.
    4. Now, run your app.
    5. It will stop at the breakpoint.
    6. Move your mousepointer over the line above it .. on the PFETest(nn, ee).
    7. A little yellow box should appear showing the current value of PFETest(nn, ee)
    8. My guess is that it will be 101.

    Do you see that?
    If so, then the array is being populated. Good.

    I'll await your reply before moving on the the next possible issue.

    EDIT

    (BTW, my guess is that nothing is wrong with your textbox, but that something else
    is the issue .. stay tuned .. )

    EDIT-2

    If use of a breakpoint is new to you, here are a few things to keep in mind...

    1. Pressing F8 will step through your code, one line at a time
    2. To remove the breakpoint, just click the brown dot .. it acts as a toggle.
    3. To run the rest of your app, press F5.

    Spoo
    Last edited by Spoo; May 1st, 2013 at 11:21 AM.

  22. #22
    Junior Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    20

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Spoo
    My dot was red and the whole line was highlighted in red too.
    But, no yellow box

    And F8 just runs the app, same as RUN.

    I used to use breakpoints, but that was back in the OLD days, before Windows. ****, after I got medically retired, I used my GI Bill to finish college. I actually have a degree in Computer Science, but ended up working overseas on simulators and never had a chance to try any of it. So, in a way, I am very new to this, but I happen to know the words, the logic, and how things should work. But Windows syntax is so new to me, I can't assume anything.

  23. #23
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Ron

    OK, the minor differences aside, when you "hit" the breakpoint, what was
    the value of PFETest(nn, ee)?

    Was it "101" ?
    Or was it empty?

    Spoo

  24. #24
    Junior Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    20

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Spoo;

    When I moved my mouse over the line above the breakpoint, nothing happened. No yellow box, nothing. But, I just got done manually stepping though the testbank, There were a few extra lines from converting from Word to text, so it was NOT 400*9 lines, but it is now. I'll see if that made any difference. Did it. Still nothing. I'm not convinced we are ever getting to those lines.
    Ron

  25. #25
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Ron

    Let's give it one more try .. maybe VB5 does not have the "hover" feature.
    When you are at the breakpoint, add a Watch. There are several ways
    to do this.

    1. Alt-D ,, then A ,, should bring up an Add Watch dialogue box ,,, or ,,,
    2. Click Debug on the menu bar, then click Add Watch

    In the Expression box, type PFETest(nn,ee) and click OK
    You should see a Watches window with the Expression and the Value

    What is the Value?

    Is it "101"
    Or is it Empty?

    Spoo

  26. #26
    Junior Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    20

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Spoo
    Watch : : PFETest(nn, ee) : <Out of context> : Empty : Question.PFETest
    Value <Out of context>
    I'm beginning to wonder if we actually have a full program, or just a few Subs. Also, how would you get from one Sub to another if there is no sequence of steps? Calls? Hmm
    Ron

  27. #27
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Ron

    Watch : : PFETest(nn, ee) : <Out of context> : Empty : Question.PFETest
    Value <Out of context>
    While that is not a nice result, it is useful information.

    One other thing to confirm .. did you "declare" the array PFETest ??

    Declarations occur at the very top of the code window, before any subs
    The declarations section should read

    Code:
    Dim PFETest(400, 9) As String
    If you did not have this, could you add it and try the breakpoint again?
    What does the Watch window show this time?

    Spoo
    Last edited by Spoo; May 1st, 2013 at 04:45 PM.

  28. #28
    Junior Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    20

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Yes, it is the first line after the opening Public Sub PFETest()
    EXPRESSION VALUE TYPE CONTEXT
    Same results: Watch : : PFETest(nn, ee) : <Out of context> : Empty : Question.PFETest

    Is it ok that the first line of code in the whole program is a Public Sub statement. Seems like there should be a program name or something, project name? Just guessing.

  29. #29
    Junior Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    20

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    I just tried that with several other variables. None of them had any data in them, according to the WATCH thing.

  30. #30
    Junior Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    20

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    The datafile is in the same folder, so the OPEN pathname should be valid.

  31. #31
    Junior Member
    Join Date
    Apr 2013
    Location
    Tucson, AZ
    Posts
    20

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Sam
    I answered "Yes" before, but apparently it got lost. My emails are "[email protected]" and "[email protected]".
    The reason I'm curious, not only for the question code, I think I may not have a full program, but just a bunch of Subs. Does yours start from scratch, so I can see how to begin the code. I am doing it all from scratch, by hand, except buttons and a text box.
    Thanks.
    Ron Davis

  32. #32
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Ron

    I guess I didn't explain things well enough.

    Yes, it is the first line after the opening Public Sub PFETest()
    The Declarations section is before the very 1st sub you have in your code window.

    It may be somewhat counter-intuitive, but to create a Declarations statement ...

    1. put your cursor in front of the on the 1st letter of the first sub in your app.

    >> if Public Sub PFETest() is your first sub, the in front of the "P" in Public
    >> if it is not your first sub, then do it in front of the first letter of your first sub

    2. press Enter .. to move that first line of code down one row
    3. press the up arrow key to move above that first line.
    4. now, here, type in that statement
    5. when you press enter, you should see a solid line separating it from your first sub.

    Can you try that.

    Spoo
    Last edited by Spoo; May 1st, 2013 at 09:21 PM.

  33. #33
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Ron

    It just dawned on me that it might be easier if I showed the entire code.
    If you only have cbNext, you'll also need to add a CommandButton named cbStart.

    Code:
    Dim PFETest(400, 9) As String
    Public TQnum As Integer
    '
    Private Sub cbSTART_Click()
        '
        fn = "c:\myDirectory\test1.txt"
        Close #1
        Open fn For Input As #1
        nn = 1
        ' 1. read from file to array
        For ii = 1 To 400 * 9
            Line Input #1, xtr
            resu = ii Mod 9
            ee = IIf(resu = 0, 9, resu)
            ' populate array
            PFETest(nn, ee) = xtr
            ' increment counter
            nn = IIf(resu = 0, nn + 1, nn)
        Next ii
        Close #1
        ' 2. show 1st question/answer "cluster"
        With Text1
            .Text = Empty
            For ii = 1 To 9
                .Text = .Text + PFETest(1, ii) + vbCrLf
            Next ii
            TQnum = 1
        End With
        '
    End Sub
    '
    Private Sub cbNEXT_Click()
        '
        TQnum = TQnum + 1
        With Text1
            .Text = Empty
            For ii = 1 To 9
                .Text = .Text + PFETest(TQnum, ii) + vbCrLf
            Next ii
        End With
        '
    End Sub
    This produces the image in post #18.

    There are only 2 subs .. cbStart, and cbNext
    As you can see, the Declarations "section" is above the first sub.

    Hope that helps.

    Spoo
    Last edited by Spoo; May 2nd, 2013 at 06:12 AM.

  34. #34
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,622

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Yes...full (and pretty lengthy) coded program....I'll attempt to email you a copy (less the .exe--you can compile it yourself). Hopefully it is not too large for yahoo or gmail. (And, please excuse it's code....I wrote this in 2008 (and before), but have learned a lot better ways of coding many functions since then). But, this should give you a good example of how "I" did it.

    Also, as an aside...instead of posting your email on this site, next time simply send a Private Message to whomever you'd like to communicate directly....(click on that user's name, and you will be brought to another page where you can send a Private Message).

  35. #35
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,622

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Ron...WAY too big (82MB). I've got a much smaller program that I'll send that gives you the same concept.

  36. #36
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,622

    Re: Display Formatted Text Output From VB5 on screen, in a form, or any way possible

    Just emailed you an Irish Quiz program.....it's complete, and you should be able to use most of the code in it...you can reply to that email I used to send it if you have questions.

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