Sunday 26 February 2017

Sublime Text Editor Keyboard shortcut Keys

 Sublime Text Editor Keyboard shortcut Keys

Sublime Text  is a one of the top most simple & cross platform  source code editor. Please find out the some very useful shortcut keys for sublime text editor your easy and fast coding. All the shortcut is tested and used by me when I use to coding to speedup work.




1.     Ctrl + PgUp (Page Up)  -  Switch between opened pages (Right  to  Left)
2.     Ctrl + PgDn (Page Down) -  Switch between opened pages (Left  to  Right)
3.     Ctrl + Home - Go to at the top of page.
4.     Ctrl + End - Go to at the end of page.
5.     Ctrl + Delete – Delete a whole Word within one press.
6.     Shift + Delete - Delete a whole line and clear the space at the same time  within one press.
7.     Ctrl +Shift + Delete - Delete a whole line and remain the space of that line within one press.
8.     Ctrl + J -  Remove the white space or collect the whole text into one line (convert to minified version)
9.     Ctrl + Double K- Remove the whole line from right side to the cursor.
10.            Ctrl + Shift + K - Remove the whole line no matter where is your cursor in the line.
11.            Ctrl + L – Select the whole line at a time no matter where is your cursor in the line.
12.            Ctrl + D – Select all common text from the whole document and make them updatable at the same time.
13.            Ctrl +Shift + D – Make the copy of the whole line just below the line, No matter where is your cursor in line.
14.            Ctrl + Down Arrow – Make the cursor fixed at the top and scroll the page.
15.            Ctrl + Up Arrow (Default)-  Make the cursor fixed at the bottom and scroll the page .
16.            Shift + Up Arrow - Select the content up side from the cursor, one line at a time or vice versa.
17.   Shift + Down Arrow - Select the content down side from the cursor, one line at a time or vice versa.
18.            Shift + Left Arrow - Select the content left side from the cursor, one letter at a time or vice versa.
19.            . Shift + Right Arrow - Select the content right side from the cursor, one letter at a time or vice versa.
20.            Ctrl +Shift + Left Arrow - Select the content left side from the cursor, one word at a time or vice versa.
21.            Ctrl +Shift + Right Arrow - Select the content right side from the cursor, one word at a time or vice versa.

Tuesday 22 April 2014

Transfer the content from DropdownList1 to DropdownList2 and vice versa.



Create a web application with two DropdownList1 & DropdownList2 and design application to transfer the  content from  DropdownList1 to DropdownList2  and vice versa.

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

namespace ADO.net_Tutorial
{
    public partial class WebForm6 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ListItem selecteditem = new ListItem("Select", "7");

                ListItem item1 = new ListItem("One", "1");
                ListItem item2 = new ListItem("Two", "2");
                ListItem item3 = new ListItem("Three", "3");

                ListItem item4 = new ListItem("Four", "4");
                ListItem item5 = new ListItem("Five", "5");
                ListItem item6 = new ListItem("Six", "6");

                selecteditem.Selected = true;
               DropDownList1.Items.Add(selecteditem);
               DropDownList2.Items.Add(selecteditem);

               DropDownList1.Items.Add(item1);
               DropDownList1.Items.Add(item2);
                DropDownList1.Items.Add(item3);

             DropDownList2.Items.Add(item4);
             DropDownList2.Items.Add(item5);
             DropDownList2.Items.Add(item6);

            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {

            ListItem[] List1Array = new ListItem[DropDownList1.Items.Count];
           DropDownList1.Items.CopyTo(List1Array, 0);

            ListItem[] List2Array = new ListItem[DropDownList2.Items.Count];
           DropDownList2.Items.CopyTo(List2Array, 0);

           DropDownList1.Items.Clear();
            DropDownList2.Items.Clear();
          
            foreach (ListItem myItem in List1Array)
            {                
                DropDownList2.Items.Add(myItem.Text);
            }

            foreach (ListItem myItem in List2Array)
            {
           DropDownList1.Items.Add(myItem.Text);
            }
        }
    }
}

Output:-



If anyone have any doubt about the program , please comment and you can also mail me on "ibsarmschauhan13@gmail.com" and "makansingh42@yahoo.com".

Thank you so much :)

Sunday 20 April 2014

Single Dimensional Array

Accept and print the single dimensional array.

using System;

namespace TestArray
{
class program
{
   static void Main(string[] args)
       {
           int[] arr1 = new int[5];
           Console.WriteLine("Enter the value for array:");
           for(int i=0; i<5; i++)
           {
           arr1[i]= Convert.ToInt16(Console.ReadLine());
           }
           Console.WriteLine("Display the single dimensional array:");
           foreach (int i in arr1)
           {
               Console.WriteLine(i);
           }
           Console.ReadKey();
       }       
}
}

Multidimensional Array

Accept the value for multidimensional  array from user and print the it  in matrix format.

using System;
namespace testArray
{
    class Program
    {
        static void Main(string[] args)
        {Console.WriteLine("Enter the value for multidimensional array:");
            int[,] arr1 = new int[3, 2];
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    arr1[i, j] = Convert.ToInt32(Console.ReadLine());
                }
            }
                      Console.WriteLine("Displaying the multidimensional array in matrix format :");

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    Console.Write(arr1[i, j] +"  ");
                }
                Console.WriteLine( "\n");
               }
            Console.ReadKey();
        }
    }
}

Output:-
Enter the value for multidimensional array:
2
3
5
9
1
0

Displaying the multidimensional array in matrix format :
2  3
5  9
1  0


Jagged array.


Accept and print the value of jagged array.

using System;

namespace JaggedArray
{
    class Program
    {
        static void Main(string[] args)
        {         
            int[][] jagged = new int[3][];

            Console.WriteLine("Enter value for 1st row:");
            jagged[0] = new int[3];
            for (int i = 0; i < 1; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    jagged[i][j] = Convert.ToInt32(Console.ReadLine());
                }
            }

            Console.WriteLine("Enter value for 2nd row:");
            jagged[1] = new int[2];
            for (int i = 1; i < 2; i++)
            {
                for (int j = 0; j <2; j++)
                {
                    jagged[i][j] = Convert.ToInt32(Console.ReadLine());
                }
            }

            Console.WriteLine("Enter value for 3rd row;");
            jagged[2] = new int[4];
            for (int i = 2; i < 3; i++)
            {
                for (int j = 0; j<4; j++)
                {
                    jagged[i][j] = Convert.ToInt32(Console.ReadLine());
                }
            }

            // Print out all elements in the jagged array.
            Console.WriteLine("\n Jagged array:");
            for (int i = 0; i <3; i++)
            {
                int[] newArray = jagged[i];
                for (int j = 0; j < newArray.Length; j++)
                {
                    Console.Write(newArray[j] + " ");   
                }
                Console.WriteLine();
            }
            Console.ReadKey();
        }
    }
}

Output:- 

Enter value for 1st row:
0
9
3
Enter value for 2nd row:
8
4
Enter value for 3rd row:
1
5
3
6

Jagged array:
0  9  3
8  4
1  5  3  6

If anyone have any doubt about the program , please comment and you can also mail me on "ibsarmschauhan13@gmail.com" and "makansingh42@yahoo.com".

Thank you so much :)


Bind (display) data in gridview using ADO.net disconneted achitechture

WAP to display data in ASP.Net GridView Control from SQL  Database using ADO.Net disconnected Architecture.

Explanation:- Please check the explanation of ADO.Net connected Architecture program.

WebForm1.aspx.cs



using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;


namespace ADO.net_Tutorial
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //bind gridviw using disconnted architechture of ado.net
            string constr = ConfigurationManager.ConnectionStrings["testconstr"].ConnectionString;
            SqlConnection con = new SqlConnection(constr);
            SqlCommand cmd = new SqlCommand(" select * from EmployeeDetails", con);
            DataSet ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            da.Fill(ds);
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
    }
}

Bind (display) data in gridview using ADO.net conneted achitechture



WAP to display data in ASP.Net GridView Control from SQL  Database using ADO.Net connected Architecture.

Explanation:- for this program, first  you have create a sql server database table ( "EmployeeDetails" ) with few Data fields like EmpID, EmName etc ,And then  create a connection string in web.config file with "testconstr" name, using  following code.
but make sure the Data Source path and AttachDbFilename  path is right or not because in following code I am using my database path.

<connectionStrings>
     <add name="testconstr" connectionString="Data Source=.\SQLEXPRESS; AttachDbFilename=C:\Users\MAKANSINGH\Documents\test.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
      providerName="System.Data.SqlClient" />
  </connectionStrings>

And then open a web page and drop a GridView control  on the webpage from ToolBox ->Data-> Gridview. then write the following code in code behind file and run your program.

If you have any doubt please contact me.

WebForm1.aspx.cs


using System;
using System.Data.SqlClient;
using System.Configuration;

namespace ADO.net_Tutorial
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
            string constr = ConfigurationManager.ConnectionStrings["testconstr"].ConnectionString;
            using (SqlConnection con = new SqlConnection(constr))
            {
                SqlCommand cmd = new SqlCommand(" select * from EmployeeDetails", con);
                con.Open();
                GridView1.DataSource = cmd.ExecuteReader();
                GridView1.DataBind();
            }
        }
    }
}

If anyone have any doubt about the program , please comment and you can also mail me on "ibsarmschauhan13@gmail.com" and "makansingh42@yahoo.com".

Thank you so much :)