Function Key(F1,F2...F12) Press (Keyboard) Open New Window Form in C# Window Application

Function Key Press Open New Window Form 

Press Function Key Like (F1,F2...F12) Open New Window Form or Existing Window Forms Using C# Window Application.

                                          DEMO




                                  C# CODING


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 WindowsFormsApplication2
{
    public partial class FunctionKey : Form
    {
        public FunctionKey()
        {
            InitializeComponent();
        }
        private void FunctionKey_Load(object sender, EventArgs e)
        {
            this.KeyUp += new System.Windows.Forms.KeyEventHandler(KeyEvent);
        }
        private void KeyEvent(object sender, KeyEventArgs e) //Keyup Event
        {
            if (e.KeyCode == Keys.F1)
            {
                Email ee = new Email();
                ee.Show();
            }
            if (e.KeyCode == Keys.F2)
            {
                Logee ll = new Logee();
                ll.Show();
            }
            if (e.KeyCode == Keys.F3)
            {
                Login li = new Login();
                li.Show();
            }
            else if (e.KeyCode == Keys.F4)
            {
                MessageBox.Show("This is Empty");
            }

        }
    }

}


First - Add New Window Form - For Using Function 

Key Event






Next - Add KeyEvent - Function Key(F1,F2,F3.....) Click Assign Form Name





Next - Run[F5] - Function Key Click Open Window 

Forms

Email Id Address Validation For Asp.Net C# Using Regex Validation

Email Id Address Validation 


Enter Email Id Address in TextBox InValid Id Display Popup Error Message Using Asp.Net C#.

                                Download Coding

                                                Download

                                     DEMO



HTML CODING

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>   
        <asp:TextBox ID="txtEamilId" runat="server" AutoPostBack="True" OnTextChanged="TextBox1_TextChanged"></asp:TextBox>
   
    </div>
    </form>
</body>
</html>


                              C# CODING

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Windows.Forms;
using System.Text.RegularExpressions;

public partial class Battery : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }  
    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
        Regex regex = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
        Match match = regex.Match(txtEamilId.Text);
        if (!match.Success)
        {
            MessageBox.Show("Invalid EmailId", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        else {

            MessageBox.Show("Valid EmailId", "Valid", MessageBoxButtons.OK, MessageBoxIcon.Information);

        }
    }
}


First Add New Form - Right Click- Solution Explorer - 

Add - Add Reference





Next - Add - Systems.Windows.Form  - OK






Next - Add TextBox From Toolbox - Id Change - AutoPostBack=True






Next - Double Click TextBoxes -  Add NameSpaces - Regex Coding For Email Validation





Next - Run[F5] - Verify Email ID





Between Query in SQL Using in Asp.Net C#

Between Query in SQL

Between SQL Query Using Compare Two Fields Like Two Dates Using in Asp.Net C#.

                                                    DEMO

                                                                                                                                                                                                        


                                           
                                            SQL Query Using C# 


 protected void Button1_Click(object sender, EventArgs e)
    {
        dbcon();
        SqlCommand cmd = new
  SqlCommand("Select report_date as[Dates],name as [Names] from dates where report_date between '"+txtFrom.Text+"' and '"+txtTo.Text+"'",con);
        SqlDataAdapter adp = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        adp.Fill(dt);
        SqlDataReader rd = cmd.ExecuteReader();
        if (rd.Read())
        {
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
    }


Add Between Sql Command For Compare Two Date Database Table 




Compare Two Dates in Between SQL Query Using DateTimePicker Jquery Calender in Asp.Net C#

Compare Two Dates in Between SQL Query

Compare Two Date Values with SQL Between Command Query Using DataTime Picker  JQuery Calender Control Using in Asp.Net C#.


Jquery Calender View Format,Month,Year 

Jquery Calender With TextBox


Jquery DatePicker with Textbox Using Asp.Net C#
Calender Control DatePicker Using JQuery
Show PopUp Window Open DateTimePicker


                                              DEMO




                            HTML CODING


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>jQuery UI Datepicker - Default functionality</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
     <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
    <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
    <script src="http://code.jquery.com/ui/1.11.0/jquery-ui.js"></script>

    <script type="text/javascript" lang="javascript">
        $(function () {
            $("#<%=txtFrom.ClientID %>").datepicker({
                changeMonth: true,
                changeYear: true,
                chandeDate: true
            });         
        });
        $(function () {
            $("#<%=txtTo.ClientID %>").datepicker({
                 changeMonth: true,
                 changeYear: true,
                 chandeDate: true
            });
        });
    </script>
</head>

<body>
<form id="form1" runat="server">
<div> 

    <asp:Label ID="Label1" runat="server" Text="From Date "></asp:Label>
<asp:TextBox ID="txtFrom" runat="server"></asp:TextBox>
    <asp:Label ID="Label2" runat="server" Text="To Date"></asp:Label>
    <asp:TextBox ID="txtTo" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" />
 
</td><td><asp:GridView ID="GridView1" runat="server">
       <AlternatingRowStyle BackColor="#9999FF" />
      <HeaderStyle BackColor="#FF3300" />
            <RowStyle BackColor="Silver" />
    </asp:GridView></td></tr></table></div></form></body></html>


C# CODING

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data.OleDb;
using System.Data;
using System.Data.SqlClient;


public partial class Default4 : System.Web.UI.Page
{
    SqlConnection con;
    public void dbcon()
    {
        string connn = (System.Configuration.ConfigurationManager.ConnectionStrings["dbcon"].ToString());
        con = new SqlConnection(connn);
        con.Open();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
      
    }     
    protected void Button1_Click(object sender, EventArgs e)
    {
        dbcon();
        SqlCommand cmd = new
  SqlCommand("Select report_date as[Dates],name as [Names] from dates where report_date between '"+txtFrom.Text+"' and '"+txtTo.Text+"'",con);
        SqlDataAdapter adp = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        adp.Fill(dt);
        SqlDataReader rd = cmd.ExecuteReader();
        if (rd.Read())
        {
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
    }
}


First  - Add New WebForm - Add GridView - Textbox For Input Date From ToolBox





Next - Add JQuery DateTimePicker For Two TextBoxes





Next - Add Between Sql Command For Compare Two Date Database Table 






Next - Run[F5]  - Compare Two Dates  - Show Result








What is TCL or Transaction Control Command in SQL Server


Transaction Control (TCL)

TCL Statements are used to Manage the changes Made by DML Statements.  
 It allows statements to be Grouped Together into Logical Transactions.

Examples:

COMMITSaves  After  Finished
ROLLBACKRestore Database to Original Since the Last COMMIT

SAVEPOINTIdentify a Point in a Transaction
SET TRANSACTIONChange Transaction Like Isolation level.