Visual basic

I am having trouble with an assignment in my intro to VB class. The solution is on here, but it's not working. Any help would be greatly appreciated.
nikrubi512Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
*** sprinkles nikrubi512 with internet magic dust ***

Did it work?  Probably not....

Hi nikrubi512,

It would be absolutely MAGICAL if we somehow managed to help you with a problem that you haven't explained...at all.

We can't help you if we don't know what the problem is!  Describe the assignment, post your work thus far, and pinpoint where the problem is.

I'm SURE we can help you...   =)

~IM
0
nikrubi512Author Commented:
Hey...sorry, just wanted to make sure someone could help me before I posted all the info.
It's the "good morning" problem...chapter 14 in clearly VB....I need a pretest counter to count down. Actually, here's what my professor is looking for and I'll also attach the code...well, what I have so far.
Let me know what you think!
Thanks!!!
Nicole

from my instructor:
Exercise 3 from chapter 14: Pretest loop will count down from the number of times entered by the user.
Posttest loop will output the following if a user enters the number 4, so it will count up:
1 Good Morning!
2 Good Morning!
3 Good Morning!
4 Good Morning!


good-morning.docx
0
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
You've basically got it 99% done!

This line needs to be modified:

                lblMessage.Text = lblMessage.Text & strMESSAGE _
                    & ControlChars.NewLine

In both btnPreTest and btnPosttest so that the number is added to the message as well.

What variable can you use in each case to display the proper number?
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

nikrubi512Author Commented:
I don't know, that's why I'm asking the genius!! :)
0
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
Let me rephrase the question then...

In each case, Pre & Post, what variable is the "loop control variable"?
http://en.wikipedia.org/wiki/Control_variable

That is to say, what variable is being incremented/decremented and being tested for some condition?

You can print a variable to the "Immediate Window" in the IDE using code like this:

    Dim i As Integer

    ...
        Debug.WriteLine("i = " & i)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nikrubi512Author Commented:
Integer? I'm just not sure how to write it. I have to run an errand...be back soon. I appreciate your help!
Nicole
0
nikrubi512Author Commented:
Also, if you'd like contributions to the "beer fund" I have 2 more assignments to work on! Let me know

0
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
Try something like this out...maybe it will help you see what needs to be done.

Add a button (Button1) to your form:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim msg As String
        Dim num As Integer
 
        num = 911
        msg = "Dial " & num & " in case of emergency"

        MessageBox.Show(msg)
    End Sub

Open in new window

0
nikrubi512Author Commented:
Thank you...finally figured it out and got 100%!  Now I have 3 more assignments to complete. This is my last week of class and I have a B, but would LOVE to finish with an "A." I don't want you think that I'm cheating or seeking help with assignments for a class teaching something that I plan on using in the future. I took this class as an elective for fun! I like it, but I have really struggled through it...
Anyway, this is the next problem: "Average score' which will allow the user to add 5 scores, and then it will blink 6 times if the average is over 80. Now I have to modify it using a posttest loop.

' Name:         Average Score Project
' Purpose:      Display the average score
' Programmer:   Nicole Rubio 4-18-10

Public Class frmMain

    Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub

    Private Sub btnCalc_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCalc.Click
        'calculates and displays the average test score  

        Const strPROMPT As String = "Enter a score:"
        Const strTITLE As String = "Average Score"
        Dim strInputScore As String
        Dim decScore As Decimal
        Dim intNumScores As Integer ' counter
        Dim decTotalScores As Decimal ' accumulator
        Dim decAverage As Decimal

        intNumScores = 1 'initialize to 1 necessary for correct division
        decTotalScores = 0
        Do Until intNumScores > 5
            strInputScore = InputBox(strPROMPT, strTITLE)

            Decimal.TryParse(strInputScore, decScore)
            decTotalScores = decTotalScores + decScore
            intNumScores = intNumScores + 1
        Loop

        ' calculate and display the average
        decAverage = decTotalScores / 5 'we are only looking for 5 scores
        lblAverage.Text = decAverage.ToString("N1")

        ' if the average is over 80, blink the lblAverage control
        If decAverage > 80 Then
            Dim intCount As Integer = 1
            Do While intCount <= 12
                'this is how we get the display to blink
                If lblAverage.Visible = True Then
                    lblAverage.Visible = False
                Else
                    lblAverage.Visible = True
                End If
                Me.Refresh()
                System.Threading.Thread.Sleep(250)
                intCount = intCount + 1
            Loop
        End If
    End Sub
End Class
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.