Default.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default9.aspx.vb" Inherits="Default9" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
      <script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <link href="Styles/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery.autocomplete.js" type="text/javascript"></script>
    <script src="js/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="js/jquery.autocomplete.js" type="text/javascript"></script>
    <script src="js/jquery.maskedinput-1.3.js" type="text/javascript"></script>
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:Panel ID="Panel1" runat="server">
    </asp:Panel>
    </div>
    </form>
</body>
</html>

Default.aspx.vb


Partial Class Default9
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        For i As Integer = 0 To 4
            Dim txtSearch As New TextBox()
            txtSearch.ID = "txtSearch" & i.ToString()
            Dim scriptText As [String] = "<script type='text/javascript'> $(document).ready(function () { $(""#txtSearch" & i.ToString() & """).autocomplete('autocomplete.ashx').result(function (event, data, formatted) { if (data) { alert(data[1]); }  });  }); </script>"
            Page.ClientScript.RegisterClientScriptBlock(Me.[GetType](), "Script" & i.ToString(), scriptText)
            Panel1.Controls.Add(txtSearch)
        Next
    End Sub
End Class

autocomplete.ashx

<%@ WebHandler Language="VB" Class="autocomplete" %>

Imports System.Web
Imports System.Web.Services
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Text
Imports System.Web.SessionState

Public Class autocomplete
    Implements IHttpHandler
 
    Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
        Dim name As String
        Dim id As String
        Dim prefixText As String = context.Request.QueryString("q")
        Dim conn As SqlConnection = New SqlConnection
        conn.ConnectionString = ConfigurationManager.ConnectionStrings("SurgereConnection").ConnectionString
        Dim stbuilder As StringBuilder = New StringBuilder
        stbuilder.Clear()
        stbuilder.Append(("select * from Tbl_SampleNames where Name LIKE '" _
                        + (prefixText + "%'")))
        Dim cmd As SqlCommand = New SqlCommand
        cmd.CommandText = stbuilder.ToString
        cmd.Connection = conn
        Dim sb As StringBuilder = New StringBuilder
        conn.Open()
        Dim sdr As SqlDataReader = cmd.ExecuteReader
     
        While sdr.Read
            name = sdr("Name").ToString
            id = sdr("NameId").ToString
            sb.Append(String.Format("{0}|{1}|{2}", name, id, Environment.NewLine))
            '  sb.Append(sdr("Supplier_name").ToString & "-" & sdr("Location_name").ToString) _
            ' .Append(Environment.NewLine)
         
        End While
        conn.Close()
        If (sb.ToString <> "") Then
            context.Response.Write(sb.ToString)
        Else
            context.Response.Write("Not available..")
        End If
    End Sub
 
    ReadOnly Property IsReusable As Boolean Implements IHttpHandler.IsReusable
        Get
            Return False
        End Get
    End Property

End Class

Default.aspx



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default7.aspx.cs" Inherits="Default7" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
      <script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <link href="Styles/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery.autocomplete.js" type="text/javascript"></script>
    <script src="js/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="js/jquery.autocomplete.js" type="text/javascript"></script>
    <script src="js/jquery.maskedinput-1.3.js" type="text/javascript"></script>
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:Panel ID="Panel1" runat="server">
    </asp:Panel>
    </div>
    </form>
</body>
</html>

Default.aspx.cs


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

public partial class Default7 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        for (int i = 0; i < 5; i++)
        {
            TextBox txtSearch = new TextBox();
            txtSearch.ID = "txtSearch" + i.ToString();
            String scriptText = "<script type='text/javascript'> $(document).ready(function () { $(\"#txtSearch"+i.ToString()+"\").autocomplete('autofill.ashx').result(function (event, data, formatted) { if (data) { alert(data[1]); }  });  }); </script>";          
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Script"+i.ToString(), scriptText);
            Panel1.Controls.Add(txtSearch);
        }
    }
}

autofill.ashx

<%@ WebHandler Language="C#" Class="autofill" %>

using System.Web;
using System.Web.Services;
using System.Data.SqlClient;
using System.Configuration;
using System.Text;
using System.Web.SessionState;

public class autofill : IHttpHandler {
   
    public void ProcessRequest (HttpContext context) {
       
        string name;
        string id;
     
           
            string prefixText = context.Request.QueryString["q"];
            SqlConnection conn = new SqlConnection();
            conn.ConnectionString = ConfigurationManager.ConnectionStrings["SurgereConnection"].ConnectionString;
            StringBuilder stbuilder = new StringBuilder();
       
                stbuilder.Clear();
                stbuilder.Append("select * from Tbl_SampleNames where Name LIKE '"+ prefixText + "%'");
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = stbuilder.ToString();
                cmd.Connection = conn;
                StringBuilder sb = new StringBuilder();
                conn.Open();
                SqlDataReader sdr = cmd.ExecuteReader();
                while (sdr.Read()) {
                    name = sdr["Name"].ToString() ;
                    id = sdr["NameId"].ToString();
                    sb.Append(string.Format("{0}|{1}|{2}", name, id, "/n"));
                    //  sb.Append(sdr("Supplier_name").ToString & "-" & sdr("Location_name").ToString) _
                    // .Append(Environment.NewLine)
                }
                conn.Close();
                if ((sb.ToString() != "")) {
                    context.Response.Write(sb.ToString());
                }
                else {
                    context.Response.Write("Not available..");
                }
         
    }

    public bool IsReusable {
        get {
            return false;
        }
    }

}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Classes : Form
    {
        public Classes()
        {
            InitializeComponent();
        }

   
        struct person
        {
            public string name;
            public string specialization;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            person p;
            p.name = "Sunitha";
            p.specialization = ".net";
            MessageBox.Show("I am " + p.name + " specializing in " + p.specialization);
        }
    }
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class constructor : Form
    {
        public constructor()
        {
            InitializeComponent();
        }
        struct person
        {
            public string name;
            public string specialization;
            public person(string mname, string special)
            {
                name = mname;
                specialization = special;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            person p = new person("Sunitha", ".net");
            MessageBox.Show("I am "+p.name+" specializing in "+p.specialization);
        }
     
    }
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class expenum : Form
    {
        public expenum()
        {
            InitializeComponent();
        }
        enum titles : int { Mr, Mrs, Dr };
        private void expenum_Load(object sender, EventArgs e)
        {
         
       
        }

        private void button1_Click(object sender, EventArgs e)
        {
            titles t = titles.Dr;
            MessageBox.Show(t + " Abdul Kalam ");
        }
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class enum1 : Form
    {
        public enum1()
        {
            InitializeComponent();
        }
        enum days {sat,sun,mon,tue,wed,thu,fri};
        private void button1_Click(object sender, EventArgs e)
        {
            int x = (int)days.sat;
            MessageBox.Show(x.ToString());

        }
    }
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class enum2 : Form
    {
        public enum2()
        {
            InitializeComponent();
        }
        enum days {sat=10,sun,mon,tue,wed,thu,fri };
        private void button1_Click(object sender, EventArgs e)
        {
            int x = (int)days.sun;
            MessageBox.Show(x.ToString());
        }
    }
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class partialclass : Form
    {
        public partialclass()
        {
            InitializeComponent();
        }
        partial class bank
        {
            private int mbalance = 3000;
            public int balance
            {
                get { return mbalance;}
                set {mbalance =value;}
            }
        }
        partial class bank
        {
            public void deposit(int amount)
            {
                balance = balance + amount;
            }
            public void withdraw(int amount)
            {
                balance = balance - amount;
            }
        }
        bank b = new bank();
        private void showbal()
        {
            label1.Text = b.balance.ToString();
            textBox1.Text = "";
            textBox1.Focus();
        }
        private void partialclass_Load(object sender, EventArgs e)
        {
            label1.Text = b.balance.ToString();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            b.deposit(Int32.Parse(textBox1.Text));
            showbal();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            b.withdraw(Int32.Parse(textBox1.Text));
            showbal();
        }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            StreamWriter sw;
            sw = File.CreateText(@"E:\text.txt");
            sw.WriteLine("sunitha");
            sw.WriteLine("sunichand2000.blogspot.com");
            sw.Close();
            System.Diagnostics.Process.Start("notepad", @"E:\text.txt");
        }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.IO;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Window2.xaml
    /// </summary>
    public partial class Window2 : Window
    {
        public Window2()
        {
            InitializeComponent();
        }
        StreamWriter sw;
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            sw = File.CreateText(@"E:\" + txtname.Text + ".txt");
            sw.WriteLine("\t\t\tCurriculam vitae");
            sw.WriteLine("Name\t:" + txtname.Text);
            sw.WriteLine("Email\t:" + txtemail.Text);
            sw.Close();
            System.Diagnostics.Process.Start("notepad.exe", @"E:\" + txtname.Text + ".txt");


        }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.IO;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Window3.xaml
    /// </summary>
    public partial class Window3 : Window
    {
        public Window3()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            Directory.CreateDirectory(@"E:\abc");
        }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.IO;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Window4.xaml
    /// </summary>
    public partial class Window4 : Window
    {
        public Window4()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            DriveInfo[] strdrives = DriveInfo.GetDrives();
            foreach (DriveInfo strdrive in strdrives)
            {
                listBox1.Items.Add(strdrive);
            }
        }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.IO;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Window5.xaml
    /// </summary>
    public partial class Window5 : Window
    {
        public Window5()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            DriveInfo[] strdrives = DriveInfo.GetDrives();
            foreach (DriveInfo strdrive in strdrives)
            {
                listBox1.Items.Add(string.Format("Drive{0}",strdrive.Name));
                listBox1.Items.Add(string.Format("File type:{0}",strdrive.DriveType));
                listBox1.Items.Add(string.Format("Volume Label:{0}", strdrive.VolumeLabel));
                listBox1.Items.Add(string.Format("File System:{0}", strdrive.DriveFormat));
                listBox1.Items.Add(string.Format("Available space to current user:{0,15}bytes", strdrive.AvailableFreeSpace));
                listBox1.Items.Add(string.Format("Total available space:{0,15}bytes", strdrive.TotalFreeSpace));
                listBox1.Items.Add(string.Format("Total size of drive:{0,15}bytes", strdrive.TotalSize));


            }
        }
    }
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class linenumber : Form
    {
        public linenumber()
        {
            InitializeComponent();
        }

        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "Text file(*.txt)|*.txt";
            string filename;
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                filename = openFileDialog1.FileName;
                int dr = 0;
                FileStream f = new FileStream(filename, FileMode.Open);
                StreamReader sr = new StreamReader(f);
                string line;
                StreamWriter sw = File.CreateText(@"E:\numbered.txt");
                while ((line = sr.ReadLine()) != null)
                {
                    dr++;
                    sw.WriteLine("{0}{1}", dr, line);
                }
                sw.Close();
                f.Close();
                MessageBox.Show("File numbered successfully");
                System.Diagnostics.Process.Start(@"E:\numbered.txt");

            }
        }
    }
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class string_format : Form
    {
        public string_format()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show(string.Format("I am {0} specializing in {1}","sunitha",".net"));
            MessageBox.Show(string.Format("I am {0} specializing in {1} based at {2}","sunitha",".net","asp"));
        }
    }
}
Properties->path->(C:\)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class filewatcher : Form
    {
        public filewatcher()
        {
            InitializeComponent();
        }

        private void fileSystemWatcher1_Created(object sender, System.IO.FileSystemEventArgs e)
        {
            MessageBox.Show(e.Name);
        }

   
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class binaryfile : Form
    {
        public binaryfile()
        {
            InitializeComponent();
        }
        BinaryWriter bw;
        FileStream fs;
        BinaryReader br;
        private void button1_Click(object sender, EventArgs e)
        {
         
            fs = new FileStream(@"E:\demo.data", FileMode.Create);
            bw = new BinaryWriter(fs);
            for (int i = 0; i < 5; i++)
            {
                bw.Write(i);
             
            }
            bw.Close();
            MessageBox.Show("Binary file created successfully");

        }

        private void button2_Click(object sender, EventArgs e)
        {
            fs = new FileStream(@"E:\demo.data", FileMode.Open);
            br = new BinaryReader(fs);
            int l = (int)fs.Length;
            for (int i = 0; i < l / 4; i++)
            {
                listBox1.Items.Add(br.ReadInt32());
            }
        }
    }
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class createaspx : Form
    {
        public createaspx()
        {
            InitializeComponent();
        }
        StreamWriter sw;

        private void create_Click(object sender, EventArgs e)
        {
            sw = File.CreateText(@"E:\hello.aspx");
            sw.WriteLine("<html>");
            sw.WriteLine("<form runat=\"server\">");
            sw.WriteLine("<asp:button text=\"hello\" runat=\"server\"></asp:button>");
            sw.WriteLine("</form>");
            sw.WriteLine("</html>");
            sw.Close();
            System.Diagnostics.Process.Start(@"E:\hello.aspx");
        }
    }
}
Class file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindowsFormsApplication1
{
    class inheritanc
    {
        private int mibalance;
        public int balance
        {
            get
            {
                return mibalance;

            }
            set
            {
                mibalance = value;
            }
        }
    }

    class inher : inheritanc
    {
        public void deposit(int amt)
        {
            balance = balance + amt;
        }
        public void withdraw(int amt)
        {
            balance = balance - amt;
        }
    }
}

Windows form file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class inheritance : Form
    {
        public inheritance()
        {
            InitializeComponent();
        }

   

        private void inheritance_Load(object sender, EventArgs e)
        {
            inheritanc kk=new inheritanc();
            MessageBox.Show(kk.balance.ToString());
        }
    }
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;

namespace WindowsFormsApplication1
{
    public partial class imagecrop : Form
    {
        public imagecrop()
        {
            InitializeComponent();
        }

        private void btncrop_Click(object sender, EventArgs e)
        {
            Bitmap mybitmap;
            Bitmap mybitmapcropped;
            Graphics mygraphics;
            Rectangle rec = new Rectangle(0, 0, 250, 300);
            mybitmap=new Bitmap(@"E:\1.jpg");
            mybitmapcropped = new Bitmap(200, 200);
            mygraphics = Graphics.FromImage(mybitmapcropped);
            mygraphics.DrawImage(mybitmap, new Rectangle(0, 0, mybitmapcropped.Width, mybitmapcropped.Height),rec.Left,rec.Top,rec.Width,rec.Height,GraphicsUnit.Pixel);
            mybitmap.Dispose();
            mybitmapcropped.Save(@"E:\2.jpg",ImageFormat.Jpeg);




        }
    }
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Examples
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int iSec = 0;
        int iMin = 0;
        int iHr = 0;
        private void Form1_Paint(object sender, PaintEventArgs e)
        {

            Graphics g = e.Graphics;
            g.DrawPie(Pens.Blue,50,50,200,200,0,90);
            g.DrawPie(Pens.Blue, 50, 50, 200, 200, 90, 90);
            g.DrawPie(Pens.Blue, 50, 50, 200, 200, 180, 90);
            g.DrawPie(Pens.Blue, 50, 50, 200, 200, 270, 90);
            g.DrawPie(Pens.Green, 50, 50, 200, 200, 90, iSec);
            iSec += 4;

            if (iSec == 360)
            {
                iMin += 6;
                iSec = 0;
            }
            g.DrawPie(Pens.Red, 50, 50, 200, 200, 90, iMin);

            if (iMin == 360)
            {
                iHr += 6;
                iMin = 0;
            }

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            Invalidate();
        }
    }
}