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.
Who is Participating?
Mike TomlinsonConnect With a Mentor Middle School Assistant TeacherCommented:
Let me rephrase the question then...

In each case, Pre & Post, what variable is the "loop 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)
Mike TomlinsonMiddle School Assistant TeacherCommented:
*** 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 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...   =)

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!

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!

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Mike TomlinsonMiddle School Assistant TeacherCommented:
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?
nikrubi512Author Commented:
I don't know, that's why I'm asking the genius!! :)
nikrubi512Author Commented:
Integer? I'm just not sure how to write it. I have to run an back soon. I appreciate your help!
nikrubi512Author Commented:
Also, if you'd like contributions to the "beer fund" I have 2 more assignments to work on! Let me know

Mike TomlinsonMiddle School Assistant TeacherCommented:
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"

    End Sub

Open in new window

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

        ' 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
                    lblAverage.Visible = True
                End If
                intCount = intCount + 1
        End If
    End Sub
End Class
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.