Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Feb 25, 2015 at 12:37 AM by Landern for the following reason:

This is a Unity Related site, your question is for WinForm

avatar image
0
Question by jewlsbuddy · Feb 25, 2015 at 12:32 AM · multiply

How do you multiply from an array using GUI

I'm trying to create this GUI program using C#. It has an array that contains the numbers 2 through 10. The program is supposed to allow the user to input a number and the program should show the products of all the numbers in the array times the users number. I'm really quite stumped.

 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
 using System.Drawing;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 
 namespace MultiplicationGUI
 {
     public partial class Form1 : Form
     {
         public Form1()
         {
             InitializeComponent();
         }
 
         private void button1_Click(object sender, EventArgs e)
         {
             int[] TimesTable = { 2, 3, 4, 5, 6, 7, 8, 9, 10 };
 
             int number = Convert.ToInt32(textBox1.Text);
             int answer = Convert.ToInt32(label2);
 
            answer = number * TimesTable[0];
            label2.Text = "The products are" + answer;
         }
     }
 }
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Landern · Feb 25, 2015 at 12:38 AM 0
Share

please only post Unity related questions, stackoverflow could be a better posting place, but they would probably scream at you.

          public Form1()
          {
              InitializeComponent();
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
              int[] TimesTable = { 2, 3, 4, 5, 6, 7, 8, 9, 10 };
  
              int number = Convert.ToInt32(textBox1.Text);
              int answer = Convert.ToInt32(label2);
  
             foreach (int multiple in TimesTable)
                 answer += " " + (number * multiple) + ",";
             
             answer.TrimEnd(',');
                 
             label2.Text = "The products are" + answer;
          }

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Simple math always returns 0 1 Answer

Pre-multiplied alpha texture 0 Answers

Vector3 NextPosition = Position / 1.1; or Vector3 NextPosition = Position * 0.99; ? 1. Position of object is (20,0,20) 2. I need to get (19,0,19) 2 Answers

Calculation error when multiplying a float 1 Answer

Error message: "Unexpected token *" javascript - wha? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges