Advertisement
DrAungWinHtut

AraOfCircle in CS

Feb 21st, 2022
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.18 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace _2022022102_CS_Parsing
  12. {
  13.     public partial class frmParse : Form
  14.     {
  15.         public frmParse()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void btnCalculate_Click(object sender, EventArgs e)
  21.         {
  22.             float fRadius = 0F;
  23.             float fArea = 0F;
  24.  
  25.              bool result = float.TryParse (txtRadius .Text,out fRadius);
  26.             if( result == true )
  27.             {
  28.                  fArea =  3.14F * fRadius * fRadius;
  29.                  txtArea.Text = fArea.ToString();
  30.             }
  31.             else
  32.             {
  33.                 MessageBox.Show("Incorrect Format, Pls Try again!");
  34.                 txtRadius.SelectAll();
  35.             }
  36.            btnCalculate .Enabled = false;
  37.             timer1.Enabled = true;
  38.         }
  39.  
  40.         private void timer1_Tick(object sender, EventArgs e)
  41.         {
  42.             btnCalculate.Enabled = true;
  43.             timer1.Enabled = false;
  44.         }
  45.     }
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement