How do I write code for these commands?

Posted on 2011-10-11
Last Modified: 2012-05-12
Hi, I'm just wondering what would be the codes for the below.
•Calls CountScoresBelowAverage(), then displays the return
•Calls CountScoresAboveOrEqualToAvg(), then displays the
return value.
•Calls CountMatchingScore(), passes it the value in the Textbox
and then displays the return value
•Calls CalcSpread(), passes it the Lowest Score & Highest
Score and then displays the return value
•Displays the number of times each value in the range 1-10
appears in the Number Listbox
Return Type None

Question by:Lan88
    LVL 85

    Accepted Solution

    Display the values in what?  A Console application or a WinForms application?

    Basically you declare a variable to hold the return value and assign the output of the function to it:

        Dim NumScoresBelowAverage As Integer = CountScoresBelowAverage()

    If a Console application, then you could display it like this:

        Console.WriteLine("Number of scores below average: " & NumScoresBelowAverage)

    If a WinForms application, then you'd assign it to a Text() property of some control (like a Label):

        Label1.Text = "Number of scores below average: " & NumScoresBelowAverage

    Author Comment


    I gathered it would be easier to attached the pdf so you have a better idea of what I am trying to achieve.

    Thanks, Lan
    LVL 85

    Expert Comment

    by:Mike Tomlinson
    That looks like a multi-line TextBox.

    You could use the AppendText() method to add each line of output:

        Dim NumScoresBelowAverage As Integer = CountScoresBelowAverage()
        TextBox1.AppendText("Number of scores below average: " & NumScoresBelowAverage & vbCrLf)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now