Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works

Visual Basic

  • Please log in to reply



    New Member

  • Member
  • Pip
  • 1 posts
Can someone help me? I am a newbie in programming.

Your GUI will have the following inputs. There will be an input textbox for each one.

1. The variable A
2. A color which shall be a String

It will also have a Do It! button. When the user clicks the button, your program will update the following output text boxes:
1. the sum of A values for which the color was "red"
2. the sum of the A values for which the color is "blue"
3. the sum of the A values for which the color is "green"

If the inputs for sets A, B, C are:

32 Red
17 blue
22 green
24 blue
23 red

the output would be

red Sum 55 blue sum 41 green sum 22

Can anyone share the code on how to construct this?
  • 0




    New Member

  • Member
  • Pip
  • 2 posts
First of all this Forum is not for doing your Homework. So do you already have some Code?
  • 0



    Visiting Staff

  • Visiting Consultant
  • 34 posts
  • MVP
This is probably long overdue, so the way I would have done this is with a Dictionary<TKey, TValue> generic collection. Check if the key for the color of type string exists, and if it does, add to the value, otherwise create a new KeyValuePair for the dictionary, and initialize the value to the value that is to be added.
  • 0

Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP