mikeyworx

ACTIVITY 8 COMPRO2

Mar 10th, 2023
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | Source Code | 0 0
  1. namespace ACT_8
  2. {
  3.     public partial class Form1 : Form
  4.     {
  5.         public Form1()
  6.         {
  7.             InitializeComponent();
  8.         }
  9.         // GONZALES JOHN MICHAEL
  10.         // BSIT CUBAO 2
  11.         private void generateButton_Click(object sender, EventArgs e)
  12.         {
  13.             int start = int.Parse(startTextBox.Text);
  14.             int end = int.Parse(endTextBox.Text);
  15.  
  16.             tableListBox.Items.Clear();
  17.             for (int i = start; i <= end; i++)
  18.             {
  19.                 for (int j = 1; j <= 10; j++)
  20.                 {
  21.                     int result = i * j;
  22.                     string line = String.Format("{0} x {1} = {2}", i, j, result);
  23.                     tableListBox.Items.Add(line);
  24.                 }
  25.             }
  26.         }
  27.         private void clearButton_Click(object sender, EventArgs e)
  28.         {
  29.             startTextBox.Clear();
  30.             endTextBox.Clear();
  31.             tableListBox.Items.Clear();
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment