Monday, October 11, 2010

Solution of above questions


Answer 1
using System;
public class evenoddarr
                {
                                public static void Main(string[]  args)
                                {
                                                int[] arr=new int[5];
                                                int odd=0,even=0;
                                                for(int i=0;i<5;i++)
                                                {
                                                                Console.Write("Value {0} :",i);
                                                                arr[i]=Convert.ToInt32(Console.ReadLine());
                                                                if(arr[i]%2==0)
                                                                                even++;
                                                                else
                                                                                odd++;
                                                }
                                                Console.WriteLine("The even nos are "+even);
                                                Console.WriteLine("The odd nos are "+odd);
                                string x=Console.ReadLine(); //for holding the screen
                                }
                }
Answer 2
using System;
public class vowelcount
                {
                                public static void Main(string[]  args)
                                {
                                                //char[] arr=new char[10];
                                                string input;
                                                int vowels=0;
                                                input=Console.ReadLine();
                                                char[] arr=input.ToCharArray();
                                               
                                                for(int i=0;i<input.Length;i++)
                                                {
                                                if(Char.ToLower(arr[i]).Equals('a')||
                                                                Char.ToLower(arr[i]).Equals('e')||
                                                                                Char.ToLower(arr[i]).Equals('i')||
                                                                                                Char.ToLower(arr[i]).Equals('o')||
                                                                                                                Char.ToLower(arr[i]).Equals('u'))
                                                                                vowels++;
                                                }
                                                Console.WriteLine("The vowels  nos are "+vowels);
                                                string x=Console.ReadLine(); //for holding the screen
                                }
                }


Answer 3:
using System;
public class factorial
                {
                                public static void Main(string[]  args)
                                {
                                                //char[] arr=new char[10];
                                                int input;
                                                long fact=1;
                                                input=Convert.ToInt32(Console.ReadLine());
                                                for(int i=input;i>0;i--)
                                                {
                                                                fact=fact * i;
                                                }
                                                Console.WriteLine("The factorial is "+fact);
                                                string x=Console.ReadLine(); //for holding the screen
                                }
                }


Answer 2://imp
using System;
using System.Windows.Forms;
using System.Drawing;
public class form1:Form
                {
                                public CheckBox c1=new CheckBox();
                                public    Button b1=new Button();
                                public form2 f2;
                               
                                public form1()
                                {
                                                //form features
                                                this.Size=new System.Drawing.Size(400,400);
                                                this.Location=new System.Drawing.Point(100,100);
                                               
                                                //checkbox features
                                                c1=new CheckBox();
                                                c1.Text="dot net";
                                                c1.Size=new System.Drawing.Size(100,50);
                                                c1.Location=new System.Drawing.Point(100,200);
                                                c1.CheckStateChanged+=new EventHandler(c1_CheckStateChanged);
                                                Controls.Add(c1);
               
                                                //button features
                                                b1=new Button();
                                                b1.Text="Click me";
                                                b1.Size=new System.Drawing.Size(100,50);
                                                b1.Location=new System.Drawing.Point(10,200);
                                                b1.Click+=new EventHandler(b1_Click);
                                                Controls.Add(b1);
f2=new form2();
               
                                }
                                public static void Main()
                                {
                                                Application.Run(new form1());
                                }

                                private void b1_Click(object sender, EventArgs e)
                                {
                                                f2.Show();
                                                f2.BringToFront();
                                }

                                private void c1_CheckStateChanged(object sender, EventArgs e)
                                {
                                                if(c1.Checked)
                                                {
                                                                f2.c1.Checked=true;
                                                                f2.c2.Checked=true;
                                                }
                                                else
                                                {
                                                                f2.c1.Checked=false;
                                                                f2.c2.Checked=false;
                                                }

                                }
                }
                public class form2:Form
                {
                                public CheckBox c1;
                                public CheckBox c2;
                public Button b1;
                                public form2()
                                {
                                                //form features
                                                this.Size=new System.Drawing.Size(400,400);
                                                this.Location=new System.Drawing.Point(100,100);
                                               
                                                //checkbox1 features
                                                c1=new CheckBox();
                                                c1.Text="c#";
                                                c1.Size=new System.Drawing.Size(100,50);
                                                c1.Location=new System.Drawing.Point(100,100);
                                                Controls.Add(c1);

                                                //checkbox2 features
                                                c2=new CheckBox();
                                                c2.Text="VS.net";
                                                c2.Size=new System.Drawing.Size(100,50);
                                                c2.Location=new System.Drawing.Point(100,200);
                                                Controls.Add(c2);
                                               
                                                //button features
                                                b1=new Button();
                                                b1.Text="Click me";
                                                b1.Size=new System.Drawing.Size(100,50);
                                                b1.Location=new System.Drawing.Point(100,300);
                                                Controls.Add(b1);
                                }
                }


Answer 2(a)//imp
public class form1:Form
                {
                                RadioButton r1;
                                RadioButton r2;
                                PictureBox p1;
                                Pen pen1;
                                Graphics g;
                                public form1()
                                {
                                                //form features
                                                this.Size=new System.Drawing.Size(400,400);
                                                this.Location=new System.Drawing.Point(100,100);
                                               
                                                pen1=new Pen(Color.Red,4);
                                                //checkbox features
                                                r1=new RadioButton();
                                                r1.Text="Line";
                                                r1.Size=new System.Drawing.Size(100,20);
                                                r1.Location=new System.Drawing.Point(100,10);
                                                r1.CheckedChanged+=new EventHandler(r1_CheckedChanged);
                                                Controls.Add(r1);
               
                                                //checkbox features
                                                r2=new RadioButton();
                                                r2.Text="Rectangle";
                                                r2.Size=new System.Drawing.Size(100,20);
                                                r2.Location=new System.Drawing.Point(100,50);
                                                r2.CheckedChanged+=new EventHandler(r2_CheckedChanged);
                                                Controls.Add(r2);
               
                                               
                                                //checkbox features
                                                p1=new PictureBox();
                                                p1.Location=new System.Drawing.Point(100,100);
                                                p1.Size=new System.Drawing.Size(400,400);
                                                p1.BackColor=Color.White;
                                                Controls.Add(p1);
                                                //
                                                // TODO: Add constructor logic here
                                                //
                                }
                                public static void Main()
                                {
                                                Application.Run(new form1());
                                }
                private void r1_CheckedChanged(object sender, EventArgs e)
                                {
                 g=p1.CreateGraphics();
                                g.Clear(p1.BackColor);
                               
                                g.DrawLine(pen1,10,10,30,30);

                }

                                private void r2_CheckedChanged(object sender, EventArgs e)
                                {
                                                g=p1.CreateGraphics();
                                g.Clear(p1.BackColor);
g.DrawRectangle(pen1,20,20,30,100);

                                }
                }
Answer 2(b)://padnu pardaina(x)
public class form1:Form
                {
                                MainMenu mBar;
                                MenuItem mFile, mf1,mf2,mf3;

                                public form1()
                                {
                                                //form features
                                                this.Size=new System.Drawing.Size(400,400);
                                                this.Location=new System.Drawing.Point(100,100);
                                                //menu features
                                                mBar=new MainMenu();
                                                mFile=new MenuItem("File");
                                               
                                                mf1=new MenuItem("Add Three Text Box");
                                                mf2=new MenuItem("Add Button");
                                                mf3=new MenuItem("Exit");

                                                mFile.MenuItems.Add(mf1);
                                                mFile.MenuItems.Add(mf2);
                                                mFile.MenuItems.Add(mf3);
                                                mf3.Click+=new EventHandler(mf3_Click);
                                               
                                                mBar.MenuItems.Add(mFile);
                                                this.Menu=mBar;
                                                //
                                }
                                public static void Main()
                                {
                                                Application.Run(new form1());
                                }

                                private void mf3_Click(object sender, EventArgs e)
                                {
                                                Application.Exit();
                                }
                }
Answer 3:
public class form1:Form
                {
                               
                                protected override void OnPaint(PaintEventArgs e)
                                {
                                                Graphics g=this.CreateGraphics();
                                                Font f1=new Font("Arial",16,FontStyle.Bold^FontStyle.Italic);
                                                SolidBrush b1=new SolidBrush(Color.Black);
                                                g.DrawString(".Net Programming",f1,b1,20,20);
                               
                                }
                                public form1()
                                {
                                                //form features
                                                this.Size=new System.Drawing.Size(400,400);
                                                this.Location=new System.Drawing.Point(100,100);

                                }
                                public static void Main()
                                {
                                                Application.Run(new form1());
                                }

                               
                }
Answer 4:
public class form1:Form
                {
                                ComboBox cb;
                                Label l1;

                                public form1()
                                {
                                                //form features//pardaina
                                                //this.Size=new System.Drawing.Size(400,400);
                                                //this.Location=new System.Drawing.Point(100,100);
                               
                                                //checkbox features
                                                l1=new Label();
                                                l1.Text="items";
                                                l1.Size=new System.Drawing.Size(200,20);
                                                l1.Location=new System.Drawing.Point(10,10);
                                                Controls.Add(l1);
                                                //checkbox features
                                                cb=new ComboBox();
                                                cb.Size=new System.Drawing.Size(200,20);
                                                cb.Location=new System.Drawing.Point(10,50);
                                                cb.SelectedIndexChanged+=new EventHandler(cb_SelectedIndexChanged);
                                                cb.Items.Add("Apple");
                                                cb.Items.Add("Orange");
                                                cb.Items.Add("Banana");
                                                Controls.Add(cb);
                                               
                                }
                               
                                public static void Main()
                                {
                                                Application.Run(new form1());
                                }
                               
                                private void cb_SelectedIndexChanged(object sender, EventArgs e)
                                {
                                                l1.Text=cb.SelectedItem.ToString();
                                }
                }

Answer 5/6:
                public class form1:Form
                {
                                OpenFileDialog ofd;
                                ColorDialog cd;
                                Button b1;
                                public form1()
                                {
                                                //form features
                                                this.Size=new System.Drawing.Size(400,400);
                                                this.Location=new System.Drawing.Point(100,100);

                                                b1=new Button();
                                                b1.Text="click";
                                                b1.Location=new System.Drawing.Point(10,10);
                                                b1.Size=new System.Drawing.Size(100,30);
                                                b1.Click+=new EventHandler(b1_Click);
                                                Controls.Add(b1);
                                }
                                public static void Main()
                                {
                                                Application.Run(new form1());
                                }

                                private void b1_Click(object sender, EventArgs e)
                                {
                               
                                                //for setting background image
                                                OpenFileDialog ofd=new OpenFileDialog();
                                                ofd.Filter="Bmp File (*.bmp) | *.bmp|JPeg files(*.jpg)|*.jpg|Gif files(*.gif)|*.gif";
                                                ofd.RestoreDirectory=true;
                                                if(ofd.ShowDialog()==DialogResult.OK)
                                                {
                                                this.BackgroundImage=Image.FromFile(ofd.FileName);
                                                                //MessageBox.Show(ofd.FileName);
                                                }
                               

                                                //for setting background color
                                                cd=new ColorDialog();
                                               
                                                if(cd.ShowDialog()==DialogResult.OK)
                                                {
                                                                this.BackColor=cd.Color;
                                                                //MessageBox.Show(ofd.FileName);
                                                }
                                }
                }
Answer 7:
public class form1:Form
                {
                                PictureBox p1;
                                Button b1;

                                public form1()
                                {
                                                //form features
                                                this.Size=new System.Drawing.Size(400,400);
                                                this.Location=new System.Drawing.Point(100,100);
                                               
                                                //checkbox features
                                                b1=new Button();
                                                b1.Text="Draw";
                                                b1.Size=new System.Drawing.Size(100,20);
                                                b1.Location=new System.Drawing.Point(100,50);
                                                b1.Click+=new EventHandler(b1_Click);
                                                Controls.Add(b1);
               
                                               
                                                //checkbox features
                                                p1=new PictureBox();
                                                p1.Location=new System.Drawing.Point(100,100);
                                                p1.Size=new System.Drawing.Size(400,400);
                                                p1.BackColor=Color.White;
                                                Controls.Add(p1);
                                                //
                                                // TODO: Add constructor logic here
                                                //
                                }
                                public static void Main()
                                {
                                                Application.Run(new form1());
                                }
                                private void b1_Click(object sender, EventArgs e)
                                {
                                                Graphics g=p1.CreateGraphics();
                                                Font f1=new Font("Arial Black",14);
                                                SolidBrush sb=new SolidBrush(Color.Red);
                                                g.DrawString("Welcome",f1,sb,20,20);
                                                g.FillEllipse(sb,50,50,20,20);
                                }
                }
Answer 8:
public class form1:Form
                {
                                Label l1;
                                Button b1;
                                Timer t1;
                                public form1()
                                {
                                                //form features
                                                this.Size=new System.Drawing.Size(400,400);
                                                this.Location=new System.Drawing.Point(100,100);

                                                l1=new Label();
                                                l1.Text="click";
                                                l1.Location=new System.Drawing.Point(10,10);
                                                l1.Size=new System.Drawing.Size(400,30);
                                                Controls.Add(l1);
                                               
                                                b1=new Button();
                                                b1.Text="click";
                                                b1.Location=new System.Drawing.Point(10,50);
                                                b1.Size=new System.Drawing.Size(100,30);
                                                b1.Click+=new EventHandler(b1_Click);
                                                Controls.Add(b1);

                                                t1=new Timer();
                                                t1.Interval=1000;
                                                t1.Tick+=new EventHandler(t1_Tick);
                                               
                                }
                                public static void Main()
                                {
                                                Application.Run(new form1());
                                }

                                private void b1_Click(object sender, EventArgs e)
                                {
                                                                t1.Start();
                                }

                                private void t1_Tick(object sender, EventArgs e)
                                {
                                l1.Text=DateTime.Now.ToLongTimeString();
                                //l1.Text=DateTime.Now.ToLString();
                                }
                }
Answer 9:
                public class form1:Form
                {
                                Label l1;

                                public form1()
                                {
                                                //form features
                                                this.Size=new System.Drawing.Size(400,400);
                                                this.Location=new System.Drawing.Point(100,100);
                                                this.KeyPress+=new KeyPressEventHandler(form1_KeyPress);
                                               
                                                //checkbox features
                                                l1=new Label();
                                                l1.Text="Press keys";
                                                l1.Size=new System.Drawing.Size(100,20);
                                                l1.Location=new System.Drawing.Point(100,50);
                                                Controls.Add(l1);
               
                                }
                               
                                public static void Main()
                                {
                                                Application.Run(new form1());
                                }

                                private void form1_KeyPress(object sender, KeyPressEventArgs e)
                                {
                                                l1.Text="Key Pressed="+e.KeyChar;

                                }
                }
Answer 10:
Solve yourself

Answer 11:
Solve yourself

Answer 12:
public class form1:Form
                {
                                TextBox t1;
                                Button b1,b2;
                                ListBox lb;

                                public form1()
                                {
                                                //form features
                                                this.Size=new System.Drawing.Size(400,400);
                                                this.Location=new System.Drawing.Point(100,100);
                               
                                                //checkbox features
                                                t1=new TextBox();
                                                t1.Text="";
                                                t1.Size=new System.Drawing.Size(200,20);
                                                t1.Location=new System.Drawing.Point(10,10);
                                                Controls.Add(t1);
                                                //checkbox features
                                                b1=new Button();
                                                b1.Text="Add";
                                                b1.Size=new System.Drawing.Size(200,20);
                                                b1.Location=new System.Drawing.Point(10,50);
                                                b1.Click+=new EventHandler(b1_Click);
                                                Controls.Add(b1);
                                               
                                                //checkbox features
                                                b2=new Button();
                                                b2.Text="Remove";
                                                b2.Size=new System.Drawing.Size(200,20);
                                                b2.Location=new System.Drawing.Point(10,80);
                                                b2.Click+=new EventHandler(b2_Click);
                                                Controls.Add(b2);

                                                lb=new ListBox();
                                                lb.Size=new System.Drawing.Size(200,100);
                                                lb.Location=new System.Drawing.Point(10,150);
                                                Controls.Add(lb);
               
                                }
                               
                                public static void Main()
                                {
                                                Application.Run(new form1());
                                }
                                private void b1_Click(object sender, EventArgs e)
                                {
                                                if(t1.Text!="")
                                                                lb.Items.Add(t1.Text);
                                                t1.Text="";
                                }

                                private void b2_Click(object sender, EventArgs e)
                                {
                                                if(lb.SelectedIndex!=-1)
                                                {
                                                                lb.Items.RemoveAt(lb.SelectedIndex);
                                                }
                                                else
                                                                MessageBox.Show("No item selected to remove");

                                }
                }
Answer 13:
Solve yourself

Answer 14:
public class form1:Form
                {
                                LinkLabel l1;
                                public form1()
                                {
                                                //form features
                                                this.Size=new System.Drawing.Size(400,400);
                                                this.Location=new System.Drawing.Point(100,100);

                                                l1=new LinkLabel();
                                                l1.Text="Click to open google";
                                                l1.Location=new System.Drawing.Point(10,10);
                                                l1.Size=new System.Drawing.Size(400,30);
                                                l1.Click+=new EventHandler(l1_Click);
                                                Controls.Add(l1);
                                               
                                }
                                public static void Main()
                                {
                                                Application.Run(new form1());
                                }

                                private void l1_Click(object sender, EventArgs e)
                                {
                                                System.Diagnostics.Process.Start("http://www.google.com");
                                }
                }
Answer 15:
public class form1:Form
                {
                                RichTextBox r1;
                                OpenFileDialog ofd;
                                SaveFileDialog sfd;
                                Button b1,b2,b3;
                                public form1()
                                {
                                                //form features
                                                this.Size=new System.Drawing.Size(400,400);
                                                this.Location=new System.Drawing.Point(100,100);

                                                b1=new Button();
                                                b1.Text="Open";
                                                b1.Location=new System.Drawing.Point(10,10);
                                                b1.Size=new System.Drawing.Size(50,30);
                                                b1.Click+=new EventHandler(b1_Click);
                                                Controls.Add(b1);

                                                b2=new Button();
                                                b2.Text="Save As";
                                                b2.Location=new System.Drawing.Point(10,50);
                                                b2.Size=new System.Drawing.Size(50,30);
                                                b2.Click+=new EventHandler(b2_Click);
                                                Controls.Add(b2);

                                                b3=new Button();
                                                b3.Text="Save";
                                                b3.Location=new System.Drawing.Point(10,90);
                                                b3.Size=new System.Drawing.Size(50,30);
                                                b3.Click+=new EventHandler(b3_Click);
                                                Controls.Add(b3);

                                                r1=new RichTextBox();
                                               
                                                r1.Location=new System.Drawing.Point(10,120);
                                                r1.Size=new System.Drawing.Size(400,300);
                                               
                                                Controls.Add(r1);
                                               
                                }
                                public static void Main()
                                {
                                                Application.Run(new form1());
                                }

                                private void l1_Click(object sender, EventArgs e)
                                {
                                                System.Diagnostics.Process.Start("http://www.google.com");
                                }

                                private void b1_Click(object sender, EventArgs e)
                                {
                                                //open the text files in richtext box
                                                ofd=new OpenFileDialog();
                                                if(ofd.ShowDialog()==DialogResult.OK)
                                                {
                                                                StreamReader sr=new StreamReader(ofd.FileName);
                                                                r1.Text=sr.ReadToEnd();
                                                                sr.Close();
                                                }

                                }

                                private void b2_Click(object sender, EventArgs e)
                                {
                                                sfd=new SaveFileDialog();
                                                sfd.Filter="All files(*.*)|*.*|text files(*.txt)|*.txt";
                                                if(sfd.ShowDialog()==DialogResult.OK)
                                                {
                                                                r1.SaveFile(sfd.FileName,RichTextBoxStreamType.PlainText);
                                                }
                                }
                                private void b3_Click(object sender, EventArgs e)
                                {

                                                r1.SaveFile(ofd.FileName,RichTextBoxStreamType.PlainText);
                                }
                }
Answer 16:
Solve yourself

Answer 17:
Solve yourself



Answer 18:
public class form1:Form
                {
                                Label l1;

                                public form1()
                                {
                                                //form features
                                                this.Size=new System.Drawing.Size(400,400);
                                                this.Location=new System.Drawing.Point(100,100);
                                                this.MouseDown+=new MouseEventHandler(form1_MouseDown);
                                               
                                                //checkbox features
                                                l1=new Label();
                                                l1.Text="Press Mouse";
                                                l1.Size=new System.Drawing.Size(200,20);
                                                l1.Location=new System.Drawing.Point(100,50);
                                                Controls.Add(l1);
               
                                }
                               
                                public static void Main()
                                {
                                                Application.Run(new form1());
                                }
                                private void form1_MouseDown(object sender, MouseEventArgs e)
                                {
                                                l1.Text="Mouse Position: "+e.X+" , "+e.Y;

                                }
                }
Answer 19:
Solve yourself



1. Use of Range Validator

<script  runat="server">
public void submit(Object sender, EventArgs e)
{
if(Page.IsValid)
   lbl1.Text="Page is valid."
else
   lbl1.Text="Page is not valid!!"
}
</script>

<html>
<body>

<form runat="server">
Enter a number from 1 to 100:
<asp:TextBox id="tbox1" runat="server" />
<br /><br />
<asp:Button Text="Submit" OnClick="submit" runat="server" />
<br /><br />
<asp:Label id="lbl1" runat="server" />
<br />
<asp:RangeValidator
ControlToValidate="tbox1"
MinimumValue="1"
MaximumValue="100"
Type="Integer"
EnableClientScript="false"
Text="The value must be from 1 to 100!"
runat="server" />
</form>

</body>
</html>

2
. Use of Regular Expression Validator

public void submit(Object sender, EventArgs e)
{
if(Page.IsValid)
   lbl1.Text="Page is valid."
else
   lbl1.Text="Page is not valid!!"
}
<html>
<body>

<form runat="server">
Enter a US zip code:
<asp:TextBox id="txtbox1" runat="server" />
<br /><br />
<asp:Button text="Submit" OnClick="submit" runat="server" />
<br /><br />
<asp:Label id="lbl" runat="server" />
<br />
<asp:RegularExpressionValidator
ControlToValidate="txtbox1"
ValidationExpression="\d{5}"
EnableClientScript="false"
ErrorMessage="The zip code must be 5 numeric digits!"
runat="server" />
</form>

</body>
</html>


3. Use of Required Field Validator

<html>
<body>

<form runat="server">
Name: <asp:TextBox id="name" runat="server" />
<br />
Age: <asp:TextBox id="age" runat="server" />
<br /><br />
<asp:Button runat="server" Text="Submit" />
<br /><br />
<asp:RequiredFieldValidator
ControlToValidate="name"
Text="The name field is required!"
runat="server" />
</form>

</body>
</html>


4. Use of Compare Validator
<html>
<body>
<form id="Form1" runat="server">
  <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
  <asp:Label id="Label1" runat="server" TextMode=”Password”>Password</asp:Label>
  <asp:Label id="Label2" runat="server" TextMode=”Password”>Confirm  Password</asp:Label>
  <asp:TextBox id="TextBox2" runat="server"></asp:TextBox>
  <asp:CompareValidator id="CompareValidator1" runat="server" ErrorMessage="Password  Mismatch" ControlToValidate="TextBox2" ControlToCompare="TextBox1"></asp:CompareValidator>
</form>

AddRotator Example
<%@ Page language="C#" Codebehind="adrotator.aspx.cs"%>
<script runat="server">

     void AdCreated_Event(Object sender, AdCreatedEventArgs e)
       {
          e.NavigateUrl="http://www.w3schools.com" ;
       }

</script>

<html>
<head>
</head>
<body>
<form runat="server">
   <asp:AdRotator id="AdRotator1" runat="server" AdvertisementFile="AdRotatorInfo.xml">  </asp:AdRotator>
 </form>
</body>
</html>

<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
 <Ad><ImageUrl>a.jpg</ImageUrl>
        <AlternativeText>Picture1</AlternativeText></Ad>

<Ad><ImageUrl>b.jpg</ImageUrl>
        <AlternativeText>Picture2</AlternativeText></Ad>
</Advertisements>

Console Programs//for exam


Console Programs//for exam

1. Write a console application in any .NET language that reads an array of integer numbers to count the number of odd and even numbers in the array and display the result

2. Write a C# Console Application that read a character array and count the number of vowels in that array. (For example: “portal” has 2 vowels)

3. Write a C# Console Application that generates the Factorial value of any given integer. (For example: 5! = 5*4*3*2*1)

Windows Programs

1. Write a complete Managed Windows application with a TextBox control containing a ContextMenu to change the font of text written on the TextBox

2. Write a complete program that has the following two forms with the controls as shown in figure://imp




The program should be able to perform the following tasks:
(i)                 When the user clicks Open button of form 1, form2 should open.
(ii)               When the user checks the checkbox in form 1 both of the checkboxes of form 2 should be checked and when the user uncheck the checkbox in form 1 both of the checkboxes of form 2 should be unchecked.
Similar Questions//imp
3. Write the OnPaint() Method to draw a string ".NET Programming" in Bold Italic.

4. Write a complete Windows Application that has a ComboBox control with the list of the fruits. Display the selected fruit in the another label on its change event.

5. Write a code snippet to display the OpenFile dialog box, set its filter to BMP, JPG and GIF images only, and if the user clicks ok, the selected image should be set as the background image of the form

6. Write a code snippet for an event handler to a button click so that when the button is clicked, a ColorDialog must be shown. When the user selects a color and clicks OK, the selected color should be the background color of the form

7. Write a GDI+ application that draws string “WELCOME” with red brush and fills a circle of radius 20 using the same brush in a PictureBox control when a user clicks “Draw” button

8. Write a complete Windows Application that uses Timer component to develop a digital clock in a Label control when a button is clicked//pardaina

9. Write a code snippet to register key pressing event and create event handler for the event to show which key was pressed in a Label control /pardaina

10. Write a complete Windows program that has a Label and a Button control. When the button is clicked, a ColorDialog should appear. The selected color should be the background color of the Label.//same as q.6

11. Write a windows application that has two TextBox controls taking input of numerator and denominator for division. While clicking “Divide” button, the result must be displayed on a Label. Give provisions for exceptions that might occur in the program/pardaina

12. Write a Windows application to add inputs of a textbox into a listbox and also delete the selected item in listbox with provided ‘Add’ and ‘Delete’ buttons. /pardaina

13. Write a windows program to catch DivideByZero Exception and FormatException Exception. /pardaina

14. Write a windows program with LinkLabel to open up Internet Explorer with the URL www.google.com/pardaina

15. Write a windows program with RichTextBox and the functionality to save into a file and open from the file

16. Write a windows program to change the background color of a PictureBox in a form using ColorDialog Object

17. Write a windows program to draw a filled Rectangle and Oval having SolidBrush in a PictureBox.

18. Write a program to display the position of the mouse clicked in a label in your form

19. Write simple individual windows programs illustrating the features of the controls: ComboBox, Tree, Tab.

           
Database Programs

1. Use ADO.NET classes to connect to a database and find the total number of records in a particular table

2. Write a program that connects to and disconnects from database and displays the connection state.
 
3. Write a program to select records from database and display them in ListBox.

4. Write a complete ASP.NET web Application with a code-behind page that uses appropriate ADO.NET classes to verify user's password and allow them to change it to a new password by typing the password two times. Use a validation control to ensure that the new password typed in the two textboxes are same. Make necessary assumption of your own for the database, table and its columns

5. Write a program that connects to and disconnects from database and displays the connection state.

6. Write a program to count records in table.

7. Write a program to connect to database using DataAdapter and fill the DataSet, display content in DataGrid.


Web Programs

1.      Write a Simple Web Form Page with Validators.

2. Write a Web Form with AdRotator

3. Create a Web Service that calculates Simple Interest (I) based on the Principal (P), Annual Rate (R) and Year (Y)

4. Write a web services that provides current temperature of your city

5. Write an ASP.NET web form with appropriate validation controls to ensure that an entry in a TextBox control cannot be blank and will be between 0 and 100.

6. Write a code snippet to utilize logic that executes only once when a page loads

7. Write a simple “Hello World” Web Service and steps to consume this web service

8. Write a complete ASP.NET program with code-behind page that has a CheckBox web server control and a TextBox web server control. Use validation control to assure that the TextBox is not empty. When the user clicks submit button, the typed name and the status of the CheckBox (Checked or Unchecked) should be shown in a Label control.

9. Write a complete ASP.NET web form with AdRotator control that asks for your name and displays the name in a label.

10. Write a complete ASP.NET web Application with a code-behind page that uses appropriate ADO.NET classes to verify user's password and allow them to change it to a new password by typing the password two times. Use a validation control to ensure that the new password typed in the two textboxes are same. Make necessary assumption of your own for the database, table and its columns

Write a program to select records from database and display them in ListBox.//All


Write a program to select records from database and display them in ListBox.//All
Try{
string constring=@"Data  Source=C:\anudb1.mdb;"+@"Provider=Microsoft.Jet.OLEDB.4.0";
string mySelectQuery = "Select * from Profile";                  
OleDbConnection myConnection = new OleDbConnection(constring);
OleDbCommand myCommand = new OleDbCommand(mySelectQuery,myConnection);
myConnection.Open();
OleDbDataReader myReader=null;
myReader = myCommand.ExecuteReader();
while(myReader.Read())
      {
      listBox1.Items.Add(myReader["Name"]+" , "+myReader["Address"]);
      }
myReader.Close();
myConnection.Close();
}catch(){}
 
 
Write a program to connect to database using DataAdapter and fill the
DataSet, display content in DataGrid.
string strSql="Select * from Profile";
string constring=@"Data Source=C:\anudb1.mdb;"+@"Provider=Microsoft.Jet.OLEDB.4.0";
OleDbConnection con=new OleDbConnection(constring);
OleDbDataAdapter adap=new OleDbDataAdapter();              
adap.SelectCommand=new OleDbCommand(strSql,con);
DataSet ds=new DataSet();
adap.Fill(ds);
this.dataGrid1.DataSource=ds;