Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Globalization;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Chase_Projec
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- int textBoxData;
- bool isTextNumeric = int.TryParse(textBox1.Text, out textBoxData);
- if (isTextNumeric)
- {
- if (textBoxData <= 12)
- {
- var dateInfo = CultureInfo.CurrentCulture.DateTimeFormat;
- string monthName = dateInfo.GetMonthName(textBoxData);
- label2.Text = "Output: " + monthName;
- }
- else
- {
- MessageBox.Show("Not a valid month.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- else
- {
- MessageBox.Show("Not a valid month.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement