Wednesday 29 August 2018

regular expression in C# Windows Form







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;

using System.Text.RegularExpressions;

using System.Net.Mail;



namespace regular_expression

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }



        private void button1_Click(object sender, EventArgs e)

        {

            if (!Regex.Match(textBox1.Text,"^[a-z -']+$").Success)

            {

                MessageBox.Show("Invalid name", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                textBox1.Text = " ";

            }

            else

            {

                MessageBox.Show("Data added....");

            }



     try

{      

     

  var email = new MailAddress(textBox2.Text);

}

catch (Exception)

{

        MessageBox.Show("Invalid Email", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);

        textBox2.Text = " ";



}

 



           

        }

    }

}


Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...