Saturday 1 September 2012

No mapping exists from object type System.Web.UI.HtmlControls.HtmlInputText to a known managed provider native type.

No mapping exists from object type System.Web.UI.HtmlControls.HtmlInputText to a known managed provider native type.
    cmd.Parameters.Add("@stud_rollno", txtstudroll);
              cmd.Parameters.Add("@paidfee", txtpaid);
              cmd.Parameters.Add("@remain_fee", txtremain);

that is incorrect that why you are getting error like that.
now to corect it

cmd.Parameters.AddWithValue("@stud_rollno", txtstudroll.Value);
               cmd.Parameters.AddWithValue("@paidfee", txtpaid.Value);
               cmd.Parameters.AddWithValue("@remain_fee", txtremain.Value);

cmd.Parameters.AddWithValue | insert record in asp.net

  cmd.Parameters.AddWithValue | insert record in asp.net
  cmd.Parameters.AddWithValue | insert record in asp.net
try
           {
               con.Open();
               //SqlCommand cmd = new SqlCommand("insert into feesentry_tb (stud_rollno,paidfee,remain_fee)values(8,456,555)",con);
               SqlCommand cmd = new SqlCommand("insert into feesentry_tb (stud_rollno,paidfee,remain_fee)values(@stud_rollno,@paidfee,@remain_fee)", con);
               cmd.CommandType = System.Data.CommandType.Text;
               cmd.Parameters.AddWithValue("@stud_rollno",9);
               cmd.Parameters.AddWithValue("@paidfee",233.4);
               cmd.Parameters.AddWithValue("@remain_fee",4565.34);
               cmd.ExecuteNonQuery();
              //DataTable dt = new DataTable(); 
           }
           catch(Exception ex)
           {
               Response.Write(ex);
           }


            finally
            {
               con.Close();
            }

insert record in asp.net simple program with c#

insert record in asp.net simple program with c#
insert record in asp.net simple program with c#
try
           {
               con.Open();
               SqlCommand cmd = new SqlCommand("insert into feesentry_tb (stud_rollno,paidfee,remain_fee)values(8,456,555)",con);
              // cmd.CommandType = System.Data.CommandType.Text;
              cmd.ExecuteNonQuery();
             
              
               //DataTable dt = new DataTable();
              
              
           }
           catch(Exception ex)
              {
              
               Response.Write(ex);
           }
           finally
           {
               con.Close();
           }

asp.net display code with c# | try-catch-finally in asp.net

asp.net display code with c# | try-catch-finally in asp.net
In this article i have shown to display value in to database using c# using gridview

           try
            {
               con.Open();
               string query = "select * from feesentry_tb";
               SqlCommand cmd = new SqlCommand(query, con);
               SqlDataAdapter da = new SqlDataAdapter(cmd);
               DataTable dt = new DataTable();
               da.Fill(dt);
               grdvw.DataSource = dt;
               grdvw.DataBind();
              
            }
            catch (Exception ex)
            {
                Response.Write(ex);
            }
            finally
            {
                con.Close();
            }
      

Friday 31 August 2012

Perfect number program source code in vb.net | login

Perfect number program source code in vb.net | login
How to write  Perfect number program code in vb.net using for loop and next
 Dim sum As Integer = 0
        Dim i As Integer
        For i = 1 To Convert.ToInt16(TextBox1.Text) - 1
            If (Convert.ToInt16(TextBox1.Text) Mod i = 0) Then
                sum += i
            End If
        Next
        If sum = Convert.ToInt16(TextBox1.Text) Then
            MsgBox("It is perfect no")
        Else
            MsgBox("It is no perfect no")
        End If

Login form validation in vb.net using username and password field

Login form validation in vb.net using username and password field
Onbutton_click()
{
If (UsernameTextBox.Text = "" And PasswordTextBox.Text = "") Then
            MsgBox("Enter username & password")
        Else

            If (UsernameTextBox.Text = "") Then
                MsgBox("Enter username")
            Else
                If (PasswordTextBox.Text = "") Then
                    MsgBox("Enter password")
                Else
                    If (UsernameTextBox.Text = "scott" And PasswordTextBox.Text = "tiger") Then
                        ProgressBar1.Visible = True
                        ProgressBar1.Value = 0
                        Dim i As Integer = 100000
                        While (i >= ProgressBar1.Value)
                            ProgressBar1.Value = ProgressBar1.Value + 10
                        End While
                        Form1.Show()
                        Me.Hide()

                    Else
                        MsgBox("Enter correct username & password")
                    End If
}

checkbox.checked | listbox.item | radiobutton.cheked in vb.net

checkbox.checked | listbox.item | radiobutton.cheked in vb.net
How to write vb.net code to check check box and select listItem item and add them.
    Private Sub Buttonon_Click() Handles Button1.Click

        listboxvalue.Items.Add("First Name=" + TextBoxvalue1.Text + " Last Name=" + TextBoxvalue2.Text + " Address=" + TextBoxvalue3.Text + " City="
        + ComboBox1.Text + "\nSex=")

        If (radiobuttonvalue.Checked = True) Then
            listboxvalue.Items.Add("Male")
        Else
            listboxvalue.Items.Add("Female")
        End If

        listboxvalue.Items.Add(" Age=" + NumericUpDown1.Value.ToString() + " Hobbies are=")

        If (chkvalue1.Checked = True) Then
            listboxvalue.Items.Add(" Cricket")
        End If

        If (chkvalue2.Checked = True) Then
            listboxvalue.Items.Add(" Football")
        End If

        If (chkvalue3.Checked = True) Then
            listboxvalue.Items.Add(" Tennis")
        End If

        If (chkvalue4.Checked = True) Then
            listboxvalue.Items.Add(" BasketBall")
        End If
    End Sub
End Class

while | if | dropdownlist in javascript

while | if | dropdownlist in javascript
while | if | dropdownlist in javascript
        int i = 0;
        int indx = drpdwn.SelectedIndex;
        int var = 3;
        while (i <= var)
        {
            if (i == indx)
            {
              //  lbl.Text = "you have selected" + indx;
                one.Text =Convert.ToString(indx * 8);
                break;
            }
            else
            {
                i++;
            }
        }

 <table>
    <tr><td>
    <asp:DropDownList ID="drpdwn" runat="server" AutoPostBack="True"
            ontextchanged="drpdwn_TextChanged">
    <asp:ListItem Value="1">Java Programming</asp:ListItem>
    <asp:ListItem Value="2">C Programming</asp:ListItem>
    <asp:ListItem Value="3">Asp Programming</asp:ListItem>
    <asp:ListItem Value="4">c++ Programming</asp:ListItem>
    </asp:DropDownList>
    </td></tr>
    <tr><td>
    <asp:Label runat="server" ID="lbl"></asp:Label>
   
    </td></tr>
    </table>

Palindrome number program in cpp(c++) with source code

Palindrome number program in cpp(c++) with source code
How to write c++ palindrom number Program with source code

121=121 is palindrom.
167=761 is not a palindrome number.
int pali(int);
void main()
{
int n,a;
clrscr();
cout<<"\n enter the number=";
cin>>n;
a=palindrom(n);
if(n==a)
cout<<"\n number is palindrom";
else
cout<<"\n number is not palindrom";
getch();
}
int palindrom(int x)
{
int r,sum=0;
while(x!=0)
{
r=x%10;

sum=sum*10+r;
x/=10;
}
return(sum);
}

Swapping of two number in c++ source code

 Swapping of two number in c++ source code
How to  swap of given number  in c++.
Logic to swap two number with cpp  code.
#include<iostream.h>
#include<conio.h>
#include<math.h>
class swap
{
int a,b,temp;   //declaration//
public:
void get();
void cal();
};

void swap::get()
{
cout<<"\n\n enter the first number=";
cin>>a;
cout<<"\n enter the second number=";
cin>>b;
}
void swap::cal()
{
temp=a;
a=b;
b=temp;
cout<<"after swapping \n\n a="<<a<<"\n\nb="<<b;
}


void main()
{
swap ob;
clrscr();
//ob.get();
ob.cal();
getch();
}
c++ | swap of given number |  program | source code

Armstrong number in c++ | source code | cpp armstronh number program

Armstrong number in c++ | source code | cpp armstronh number program
How to write armstrong number program in c++ with source code.
Examples of armstrong number in c++.
How to write A Program for  Armstrong Number
class arm
{
int n;
public: arm();
void display();
};
void arm::arm()
{
cout<<"\n a=";
cin>>n;
}
void arm::display()
{
int sum=0,r;
int a=n;
while(n>0)
{
r=n%10;
n=n/10;
sum=sum+(r*r*r);
}
if(a==sum)
cout<<"armstrong";
else cout<<"not armstrong";
}
void main()
{
arm ob;
clrscr();
ob.display();
getch();
}

Inner join | sql server | 2005-2008 | join query

Inner join | sql server | 2005-2008 | join query
SELECT        feesentry_tb.Paidfee, feesentry_tb.remain_fee, student.stud_fees
FROM            feesentry_tb INNER JOIN
                         student ON feesentry_tb.stud_rollno = student.stud_roll
                       
                         the above query showa inner join in sql server 2005 -2008.


SELECT        Paidfee, remain_fee,stud_fees
FROM            feesentry_tb INNER JOIN
                         student ON feesentry_tb.stud_rollno = student.stud_roll

second way to write inner join .

Javascript | div | hide show | button with source code

Javascript | div | hide show | button with source code
javascript | div | hide show | button with source code
<script>
function funshow()
{
if(document.getElementById("but1").value=="show")
{
document.getElementById('div1').style.visibility="visible"
document.getElementById("but1").value="hide"
}
else
{
document.getElementById('div1').style.visibility="hidden"
document.getElementById("but1").value="show"
}
}
</script>
<body>
<input type="button" value="show" id="but1" onclick="funshow()">
<div id='div1'style="visibility:hidden">
<table bgcolor="lightblue">
<tr><td>
Usename</td>
<td><input type="text"></td></tr>
<tr><td>
Password</td>
<td><input type="text"></td></tr>
<tr><td><input type="button" value="click">
</td></tr>
</table>
</div>
</body>

hide show div | javascript | hide show javascript with code

hide show div | javascript | hide show javascript with code
<script>
function funshow()
{
document.getElementById('div1').style.visibility="visible"
}
function funhide()
{
document.getElementById('div1').style.visibility="hidden"
}
</script>
<body>
<input type="button" value="show" id="butshow" onclick="funshow()">
<input type="button" value="hide" id="buthide" onclick="funhide()">
<div id='div1'style="visibility:hidden">
<table bgcolor="lightblue">
<tr><td>
Usename</td>
<td><input type="text"></td></tr>
<tr><td>
Password</td>
<td><input type="text"></td></tr>
<tr><td><input type="button" value="click">
</td></tr>
</table>
</div>
</body>

javascript set time | javascript date set time

 javascript set time |   javascript date set time


current time is






<script>
function javascriptdatesettime()
{
var d=new Date();
var x=d.getHours()+":"+d.getMinutes()+":"+d.getSeconds()
document.getElementById('div1').innerHTML=x
setTimeout("javascriptdatesettime()",100)
}
</script>
<body>
<div id="div1" style="color:red;font-size:30;font-family:verdana">
current time is
</div>
<input type="button" value="javascript date set time" onclick="javascriptdatesettime()">
</body>


javascript | alert | getHours| getMinutes | getYear | getMonth | getTime

javascript | alert | getHours| getMinutes | getYear | getMonth | getTime




<script>
function checkdate()
{
var d=new Date();
alert("hours:"+d.getHours());
alert("minutes:"+d.getMinutes());
alert("year:"+d.getYear());
alert("month:"+d.getMonth());
alert("date:"+d.getDate());
alert("day:"+d.getDay());
alert("seconds:"+d.getSeconds());
alert("time:"+d.getTime());
}
</script>
<body>
<input type="button" value="check timing" onclick="checkdate()">
</body>








document.getElementById | color | value | javascript code

 document.getElementById | color | value | javascript code





<script>
function tumsathhomere()
{
document.getElementById('txt1').value="tum";
document.getElementById('txt1').style.color="sath";
document.getElementById('txt2').value="ho";
document.getElementById('txt2').style.color="mere";

}
</script>
<body>
<input type="text" id="txt1">
<input type="text" id="txt2">
<input type="button" value="javascript output" onclick="tumsathhomere()">
</body>

document.getElementById in javascript example with source code

document.getElementById in javascript example with source code

javascript simple programs with concatenation
Enter First Number :
Enter First Number :



<script>
function javascriptclick()
{
x=document.getElementById('txt1').value;
y=document.getElementById('txt2').value;
alert(x+y)
}
</script>
<body>
Enter First Number :<input type="text" id="txt1">
Enter Second  Number :<input type="text" id="txt2">
<input type="button" value="click" onclick="javascriptclick()">
</body>

insert | update | delete query in sqlserver 2005-2008 with examples

insert | update | delete query in sqlserver 2005-2008 with examples
select * from feesentry_tb.

1300300
2200.34344.98
3203.34344.98
3203.34333344.93338
4203.34333344.93338
NULLNULLNULL

DELETE FROM feesentry_tb
WHERE        (stud_rollno = 3)
after deleting two rows from table.
select * from feesentry_tb

1300300
2200.34344.98
4203.34333344.93338




UPDATE feesentry_tb SET Paidfee = 600 WHERE (remain_fee = 300)

1600300
2200.34344.98
4203.34333344.93338

Top query | Order by | ascending | descending order in sql server 2005-2008

Top query | Order by | ascending | descending order in sql server 2005-2008
How to write Top query | Order by | ascending | descending order in sql server 2005-2008.

SELECT        TOP (1) cl_id, cl_name, cl_lst_name, cl_phone, cl_sal
FROM            clnt_tb
ORDER BY cl_lst_name DESC

or

SELECT        TOP (1) * from clnt_tb order by cl_lst_name desc

1ramsingh89897999910000
NULLNULLNULLNULLNULL
SELECT        TOP (2) * from clnt_tb order by cl_lst_name desc
or

ELECT        TOP (2) cl_id, cl_name, cl_lst_name, cl_phone, cl_sal
FROM            clnt_tb
ORDER BY cl_lst_name DESC

1ramsingh89897999910000
3ramayanrahi44343434312345

Order BY | Ascending | descending query in sql server 2005-2008

Order BY | Ascending  | descending  query in sql server 2005-2008
SELECT        cl_id, cl_name, cl_lst_name, cl_phone, cl_sal
FROM            clnt_tb
ORDER BY cl_lst_name


or

select * from  clnt_tb order by cl_lst_name


2ramahihi88698889
3ramayanrahi44343434312345
1ramsingh89897999910000

SELECT        cl_id, cl_name, cl_lst_name, cl_phone, cl_sal
FROM            clnt_tb
ORDER BY cl_lst_name DESC

or

select * from  clnt_tb order by cl_lst_name  desc

1ramsingh89897999910000
3ramayanrahi44343434312345
2ramahihi88698889
so , we got the idea how to use order by in  sql server with ascending order and descending order .
by default query execute ascending order.

Top Query in sql server 2005 | with example

Top Query in sql server 2005 | with example
How to use top query in sql server 2005.
select only one record from client table using top query.
Query to display single record using top query.



select * from clnt_tb

1    ram    singh    898979999    10000
2    rama    hihi    8869    8889
3    ramayan    rahi    443434343    12345

SELECT TOP (1) cl_id, cl_name, cl_lst_name, cl_phone, cl_sal
FROM clnt_tb

second way
SELECT TOP (1) *
FROM clnt_tb

1 ram singh 898979999 10000



Thursday 30 August 2012

inheritance | example | source code in C sharp

 inheritance | example | source code in C sharp
inheritance | example | source code in C sharp

namespace inh_sing
{
public class person
{
public string phone,name,address;
public void getp()
{
Console.WriteLine("Enter name:");
name=Console.ReadLine();

Console.WriteLine("Enter address:");
address = Console.ReadLine();

Console.WriteLine("Enter phone:");
phone = Console.ReadLine();


}
}

public class stud:person
{
public string course;
public int roll;
public void gets()
{
Console.WriteLine("Enter rollno:");
roll = int.Parse (Console.ReadLine());
Console.WriteLine("Enter course:");
course = Console.ReadLine();
}

public void display()
{
Console.WriteLine("Roll No:-" + roll);
Console.WriteLine("Name:-" + name);
Console.WriteLine("Course:-" + course);
Console.WriteLine("Address:-" + address);
Console.WriteLine("Phone:-" + phone);
}
}


public static void Main(string[] args)
{
stud s1 = new stud();
s1.getp();
s1.gets();
s1.display();
Console.ReadLine();
}
}
}

c sharp overloading program | c# method overloading

 c sharp overloading program | c# method overloading
c sharp overloading programs with source code
namespace overloading
{
class overload
{
public void ovl()
{
Console.WriteLine("No Parameters.");
}

public void ovl(int a)
{
Console.WriteLine("One parameter is passed i.e " + a);
}

public int ovl(int a, int b)
{
Console.WriteLine("Two parameters are passed they are" + a + "and" + b);
return a + b;
}

public double ovl(double a, double b)
{
Console.WriteLine("Two double parameters are passed they are" + a + "and" + b);
return a + b;
}
}
public class poly
{
static void Main(string[] args)
{
overload ob = new overload();
int resi;
double resd;

ob.ovl();
Console.WriteLine();

resi = ob.ovl(4, 6);
Console.WriteLine("Result  of adding these integers is" + resi);
Console.WriteLine();


resd = ob.ovl(1.11, 1.12);
Console.WriteLine("Result of adding these doubles is:" + resd);
Console.WriteLine();
Console.ReadLine();

}
}

c# exception handling programming source codes

 c# exception handling programming source codes
exception handling c#
namespace excep_sys
{

class Program
{
static void Main(string[] args)
{
int a;
Console.WriteLine("Enter some number:");
try
{
a=int.Parse (Console.ReadLine());
if(a>=0&&a<=5)
{
Console.WriteLine ("Entered number is: "+a);
}
else
{
throw new IndexOutOfRangeException();
}
}

catch(IndexOutOfRangeException ex)
{
Console.WriteLine ("Number is not between 0 to 5"+ex.Message );
}

Console.ReadLine();


}
}

c# program factorial of a number | factorial program code

 c# program factorial of a number | factorial program code
How to write  factorial of a number

namespace factorial
{
class Program
{

static void Main(string[] args)
{
int i, fact = 1, n;
String no;
Console.WriteLine("Enter a number:");
no = Console.ReadLine();
n = Convert.ToInt32(no);
for (i = 1; i <= n; i++)
{
fact = fact * i;
}
Console.WriteLine("factorial is:" + fact);
Console.ReadLine();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;

namespace factorial
{
class Program
{

static void Main(string[] args)
{
int i, fact = 1, n;
String no;
Console.WriteLine("Enter a number:");
no = Console.ReadLine();
n = Convert.ToInt32(no);
for (i = 1; i <= n; i++)
{
fact = fact * i;
}
Console.WriteLine("factorial is:" + fact);
Console.ReadLine();
}
}
}

Student program | using grade code | find out student grade

 Student program | using grade code | find out student grade
How to write C# student program  using  grade code

namespace result
{
class stud
{
public int roll, total, avg, dbms, c, cpp, vb;
string name, grade;

public void getdata()
{
Console.WriteLine("Enter roll no.:");
roll = int.Parse(Console.ReadLine());

Console.WriteLine("Enter name:");
name = Console.ReadLine();

Console.WriteLine("Enter marks in DBMS:");
dbms = int.Parse(Console.ReadLine());

Console.WriteLine("Enter marks in C:");
c = int.Parse(Console.ReadLine());

Console.WriteLine("Enter marks in CPP:");
cpp = int.Parse(Console.ReadLine());

Console.WriteLine("Enter marks in VB:");
vb = int.Parse(Console.ReadLine());
}

public void putdata()
{
total = (dbms + c + cpp + vb);
avg = total / 4;

if (avg >= 70)
grade = "distinction";
else if (avg >= 60)
grade = "first class";
else if (avg >= 50)
grade = "second class";
else if (avg >= 40)
grade = "Pass class";
else
grade = "Fail";

Console.WriteLine("Roll No: " + roll);
Console.WriteLine("Name: " + name);
Console.WriteLine("Marks in DBMS: " + dbms);
Console.WriteLine("Marks in C: " + c);
Console.WriteLine("Marks in CPP: " + cpp);
Console.WriteLine("Marks in VB: " + vb);
Console.WriteLine("Total: " + total);
Console.WriteLine("Average: " + avg);
Console.WriteLine("Grade: " + grade);
}

static void Main(string[] args)
{
stud ob = new stud();
ob.getdata();
ob.putdata();
console.readline();
}
}
}

Prime number in c sharp

 Prime number in c sharp
How to write prime number in c sharp

namespace prime
{
class Program
{
static void Main(string[] args)
{
int no, i, flag;
flag = 1;
Console.WriteLine("Enter no. to be checked:");
no =Convert.ToInt16 ( Console.ReadLine());

for (i = 2; i <= no / 2; i++)
{
if (no % i == 0)
flag = 0;
}
if (flag == 1)
Console.WriteLine("Prime.");
else
Console.WriteLine("not Prime");
Console.ReadLine();
}

}
}

Array program in C sharp | C# array programming

 Array program in C sharp | C# array programming
ARRAY  program in  C sharp | source code

namespace array_2d
{
class Program
{
static void Main(string[] args)
{
int[,] mat = new int[3, 3];
int i, j,sum=0;

Console.WriteLine("Enter 9 elements:");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
Console.WriteLine("Enter element:");
mat[i, j] = Convert.ToInt16(Console.ReadLine());
}
}

Console.WriteLine("\nThe array entered is:\n");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
Console.Write(mat[i, j]+"\t");

Console.WriteLine("\n");
}

Console.WriteLine("The sum of array elments is:");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
sum=sum + mat[i, j];
}
Console.WriteLine(sum);

Console.ReadLine();
}
}
}

Calculate Area Of Rectangle In c# | Area calculation code

 Calculate Area Of Rectangle In c# | Area calculation code

how Calculate Area Of ectangle In c#

namespace ClassRectangle
{
class Rectangle
{
int length, breadth;
int area;
public void definerectangle(int length_input, int breadth_input)
{
length = length_input;
breadth = breadth_input;
}
public int calculatearea()
{
area = length * breadth; return (area);
}
}
class Program
{
static void Main(string[] args)
{
int area1; Rectangle rect1 = new Rectangle();
rect1.definerectangle(10, 20);
area1 = rect1.calculatearea();
Console.Write("Area of Rectangle is ");
Console.WriteLine(area1); Console.ReadLine(); } } }

how to handle IndexOutOfRangeException | exception handling

 how to handle IndexOutOfRangeException | exception handling
how to handle IndexOutOfRangeException in C Sharp

namespace excep_sys
{

class Program
{
static void Main(string[] args)
{
int a;
Console.WriteLine("Enter some number:");
try
{
a=int.Parse (Console.ReadLine());
if(a>=0&&a<=5)
{
Console.WriteLine ("Entered number is: "+a);
}
else
{
throw new IndexOutOfRangeException();
}
}

catch(IndexOutOfRangeException ex)
{
Console.WriteLine ("Number is not between 0 to 5"+ex.Message );
}

Console.ReadLine();
}
}
}

Interface In C# with Code | interface implementation

 Interface In C# with Code | interface implementation
Program how to write c sharp interface program ;
namespace interfaces
{
interface Icalculation
{
void add(int a, int b);
void sub(int a, int b);
}

class calculator:Icalculation
{
int res1;
int res2;

public void add(int a, int b)
{
Console.WriteLine("Addition is:" + (a + b));
}

public void sub(int a, int b)
{
Console.WriteLine("Subtraction is:" + (a - b));
}

static void Main(string[] args)
{
calculator cl = new calculator();
cl.add(100, 100);
Console.WriteLine();
cl.sub(200, 100);
Console.WriteLine();
Console.ReadLine();
}
}
}

how to handle exception in c# | Exception handling

 how to handle exception in c# | Exception handling
Exception Handling in C#

namespace excep_sys
{

class Program
{
static void Main(string[] args)
{
int a;
Console.WriteLine("Enter some number:");
try
{
a=int.Parse (Console.ReadLine());
if(a>=0&&a<=5)
{
Console.WriteLine ("Entered number is: "+a);
}
else
{
throw new IndexOutOfRangeException();
}
}

catch(IndexOutOfRangeException ex)
{
Console.WriteLine ("Number is not between 0 to 5"+ex.Message );
}

Console.ReadLine();

}
}
}

How to design(Draw) Bar-chart in html with student marks

How to design(Draw) Bar-chart in html with student marks
How to design(Draw) Bar-chart in html with student marks
with output
<html>
<head>
<title>Bar Chart</title>
</head>
<body bgcolor=lightblue>
<h1 align=center ><u>Bar-Chart</u></h1><br>
<h3 align=center ><u>Student passed</u></h1>
<table   align=center>

<tr>
<td  height=10 width="20"  >90%</td>
<td rowspan=6 height=10 width="20" bgcolor=aabbcc></td>

</tr>
<tr>
<td   height=10 width="20" >80%</td>
<td rowspan=5 height=10 width="20" bgcolor=bbaacc></td>


</tr>
<tr><td  height=10 width="20">70%</td>
<td rowspan=4 height=10 width="20" bgcolor=ddccaa></td>

</tr>
<tr><td  height=10 width="20">60%</td>
<td rowspan=3 height=10 width="20" bgcolor=aaffaa></td>

</tr>
<tr><td  height=10 width="20">50%</td>
<td rowspan=2 height=10 width="20" bgcolor=ffooff></td>

</tr>
<tr><td  height=10 width="20">35%</td>

<td rowspan=1 height=10 width="20" bgcolor=aabbcc></td>

</tr>
<tr>
<td>0</td>
<td>Asp.Net</td>
<td>Sql Server</td>
<td>Data structure</td>
<td>C++</td>
<td>Operating System</td>
<td>C language</td>

</tr>
</table>

</body>
</html>

How to Design Admission Form In Html | With Browser Template

How to Design Admission Form In Html | With Browser Template
How to draw Admission Form In Html
<body background="D:Glacier Bkgrd.jpg">
<h2 align=center>Admission Form</h2>
<body bgcolor="c3fdb8"
<form >
<fieldset>

<legend>Personal Details</legend>
<table >

<tr><td><b>Students Name:-</td><td><input type="textbox"></td></tr>
<tr><td><b>Father's Name:-</td><td><input type="textbox"></tr>
<tr><td><b>Corespondence Address:-</td><td><textarea></textarea></td></tr>
<tr><td><b>Permanent Address:-</td><td><textarea></textarea></td></tr>
<tr><td><b>Contact No.:-</td><td><input type="textbox"></td></tr>

<tr><td><b>Date Of Birth:-</td><td><b>DD<select><option>1<option>2<option>3<option>4<option>5<option>6<option>7<option>8<option>9<option>10
<option>11<option>12<option>13<option>14<option>15<option>16<option>17<option>18<option>19<option>20
<option>21<option>22<option>23<option>24<option>25<option>26<option>27<option>28<option>29<option>30
<option>31</select><b>MM<select><option>Jan<option>Feb<option>Mar<option>Apr<option>May<option>June<option>July<option>Aug<option>Sept<option>Oct
<option>Nov<option>Dec</select><b>YYYY<select><option>1901<option>1902<option>1903<option>1904<option>1905<option>1906<option>1907<option>1908<option>1909<option>1910
<option>1911<option>1912<option>1913<option>1914<option>1915<option>1916<option>1917<option>1918<option>1919<option>1920
<option>1921<option>1922<option>1923<option>1924<option>1925<option>1926<option>1927<option>1928<option>1929<option>1930
<option>1931<option>1932<option>1933<option>1934<option>1935<option>1936<option>1937<option>1938<option>1939<option>1940
<option>1941<option>1942<option>1943<option>1944<option>1945<option>1946<option>1947<option>1948<option>1949<option>1950
<option>1951<option>1952<option>1953<option>1954<option>1955<option>1956<option>1957<option>1958<option>1959<option>1960
<option>1961<option>1962<option>1963<option>1964<option>1965<option>1966<option>1967<option>1968<option>1969<option>1970
<option>1971<option>1972<option>1973<option>1974<option>1975<option>1976<option>1977<option>1978<option>1979<option>1980
<option>1981<option>1982<option>1983<option>1984<option>1985<option>1986<option>1987<option>1988<option>1989<option>1990
<option>1991<option>1992<option>1993<option>1994<option>1995<option>1996<option>1997<option>1998<option>1999<option>2000
</select></td></tr>

<tr><td><b>Gender:-</td><td><b>Male<input type=radio name=aa><b>Female<input type=radio name=aa></td>
</tr>

</table>
</fieldset>
<br>
<b>Last Attended College:-</b><input type=text>
<br>

<fieldset>
<legend>Educational Details</legend>

<table border=1>
<tr><th>Qualification</th><th>Univesity</th><th>Year Of Passing</th><th>Percentage</th></tr>
<tr><th>SSC</th><th><input type="textbox"></th><th><input type="textbox"></th><th><input type="textbox"></th></tr>
<tr><th>HSC</th><th><input type="textbox"></th><th><input type="textbox"></th><th><input type="textbox"></th></tr>
<tr><th><input type="textbox"></th><th><input type="textbox"></th><th><input type="textbox"></th><th><input type="textbox"></th></tr>
</table>
</fieldset>

</form>

How to (design) draw Logical cartoon Table with colour in html in browser

How to (design) draw Logical cartoon Table with colour in html in browser
Logic to develop code
<html>
<body bgcolor="lightcyan">
<br>
<br>
<center>
<b>
 <font size=1 color="ffffaa">e</font>
 <font size=2 color="ffeebb">x</font>
 <font size=3 color="ffddcc">a</font>
 <font size=4 color="ffccdd">m</font>
 <font size=5 color="ffbbee">p</font>
 <font size=6 color="ffaaff">l</font>
 <font size=6 color="ffeabb">e</font>
 <font size=5 color="ff876631">s</font>
 <font size=4 color="ff567556">c</font>
 <font size=3 color="ffef23">o</font>
 <font size=2 color="ff76878">d</font>
 <font size=1 color="ff76834">e</font>
 </b>
</center>
<hr color="3453453">
<br><br>

<pre>

<b>
              
              
              
        < * * >
        <  #   >    "Hi How are you"
         !   !
         !   !
</b>
</pre>
<br>
<hr color="3453453">
<br>
<table cellspacing=1 cellpadding=1 border=1 width=500>
<tr

bgcolor="567563453"><th>Date</th><th>Subject</th><th>Time</th><th>BlockNo.</th><th>RollNo</t

h></tr>
<tr bgcolor="45674564"><td rowspan=2>25/11/2008</td><td rowspan=2>CPP</td><td rowspan=2>2pm

to 5pm</td><td>21</td><td>1400 to 1430</td></tr>
<tr bgcolor="45674564"><td>22</td><td>1431 to 1460</td></tr>
<tr  bgcolor="6534545"><td rowspan=2>26/11/2008</td><td rowspan=2>MSS</td><td rowspan=2>2pm

to 5pm</td><td>19</td><td>1400 to 1430</td></tr>
<tr  bgcolor="6534545"><td>20</td><td>1431 to 1460</td></tr>
<tr bgcolor="45674564"><td rowspan=2>29/11/2008</td><td rowspan=2>CN</td><td rowspan=2>2pm

to 5pm</td><td>20</td><td>1400 to 1430</td></tr>
<tr bgcolor="45674564"><td>21</td><td>1431 to 1460</td></tr>
<tr  bgcolor="6534545"><td rowspan=2>30/11/2008</td><td rowspan=2>WST</td><td rowspan=2>2pm

to 5pm</td><td>21</td><td>1400 to 1430</td></tr>
<tr  bgcolor="6534545"><td>22</td><td>1431 to 1460</td></tr>
<tr bgcolor="45674564"><td rowspan=2>1/12/2008</td><td rowspan=2>OOAD</td><td rowspan=2>2pm

to 5pm</td><td>21</td><td>1400 to 1430</td></tr>
<tr bgcolor="45674564"><td>22</td><td>1431 to 1460</td></tr>
<tr  bgcolor="6534545"><td rowspan=2>2/12/2008</td><td rowspan=2>STATS</td><td rowspan=2>2pm

to 5pm</td><td>21</td><td>1400 to 1430</td></tr>
<tr  bgcolor="6534545"><td>22</td><td>1431 to 1460</td></tr>
</b>
</table>
</body>
</html>

How to Create Embedded css | write css code | Logic

How to Create Embedded css | write css code | Logic
Whenever you want to write or create css just write script within the head tag.
Then close after </script>
<head><script> ... your Script code Here ....</script></Head>

<head><title>Contents</title>
<style type="text/css">

a{
text-decoration:none;
color:white;
font-size:16;
}

a:hover{
background-color:cyan;
font-size:16;
}



td
{
width:120px;
height:16px;
background-image:url('images\bgr.jpg');
font-style:verdana;
font-size:12px;
font-weight:normal;
text-align:center;
background-color:#9ACD32;
}

th
{
width:120px;
COLOR:blue;
height:21px;
background-image:url('images\SUBMIT.gIF');
font-style:verdana;
font-size:15px;
font-weight:normal;
text-align:center;
background-color:hotpink;
}


</style>
</head>

Monday 27 August 2012

While loop | c program while loop | examples with source code

 While loop | c program while loop | examples with source code
 In this program we are going to learn  how to write
source code for Prime number using while loop
in function.
#include<stdio.h> //header files//
#include<conio.h>
void main()
{              //start the program prime number//
int flag=1,i,no;
clrscr();
printf("Enter any number"); // enter any number//
scanf("%d",&no);
i=2;
while(i<=no/2) //applied While loop for  cheking  condition//
{
if(no%i==0) // start number is  equals to Zero//
{
flag=0;
break; // Break the Loop//
}
i++;
}
if(flag==1) //continue//
{
printf("the number is prime number");
}
else
{
printf("th number .is not prime number");
}
getch();
} // end of program//
The number which divided by 1 and itself only.
rather than this if the number divide by any other number
then we must say it is not a prime number
output is
1).Enter any number17
Number i prime number

2).Enter any number25
Number .is not prime number.

c program Decimal to binary | convert in c

c program  Decimal to binary | convert in c
how to convert | decimal  number to binary number in  c language
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int a,i=0,n,bin=0,r;
clrscr();
printf("enter the decimal no \n");
scanf("%d",&n);
while(n != 0)
{
r=n%2;
//  a=pow(10,i);
bin=bin+(pow(10,i)*r);
i++;
n=n/2;
}
printf("binary no.=%d \n",bin);
printf("enter the binary no \n");
scanf("%d",&n);
i=0;
bin=0;
while(n != 0)
{
r=n%10;
bin=bin+(pow(2,i)*r);
i++;
n=n/10;
}
printf("decimal no.=%d",bin);

getch();
}

C Programs | Array | Malloc | sizeof

C Programs | Array | Malloc | sizeof

How to write  C Programs | Array | Malloc | sizeof

#include<stdio.h>
#include<conio.h>
void main()
{
int *a,i,n;
clrscr();
printf("enter the no of elements");
scanf("%d",&n);
a=(int *)malloc(n*sizeof (int));
printf("enter array elements");
for(i=0;i<n;i++)
{
printf("a[%d]=",i);
scanf("%d",a+i);
}
printf("array elements is\n");
for(i=0;i<n;i++)
printf("%5d",*(a+i));
getch();
}

Switch Case Statement in c language

Switch Case Statement in c language
 printf("Enter a no:\n");
scanf("%d",&n);
switch(n)
{
case 1 : printf("One");
break;
case 2 : printf("Two");
break;
case 3 : printf("Three");
break;
case 4 : printf("Four");
break;
case 5 : printf("Five");
break;
case 6 : printf("Six");
break;
case 7 : printf("Seven");
break;
case 8 : printf("Eight");
break;
case 9 : printf("Nine");
break;
default : printf("wrong no");
break;
}
getch();
}

Pattern Tutorials in c language

 Pattern Tutorials in c language
C |  Pattern Tutorials | with outputs
#include<stdio.h>
#include<conio.h>
void main()
{
int i,l,p=1;
clrscr();
for(i=1;i<=5;i++)
{
if(i%2!=0)
{
for(l=1;l<=5;l++)
printf("%4d",l*i);
}
else
{
for(l=1;l<=5;l++)
printf("%4d",l*i);
}
printf("\n");
}
getch();
}
write this code in Turbo c and see what will be output
#include<stdio.h>
#include<conio.h>
void main()
{
int q,i,j,s,t=9,p;
clrscr();
for(i=1;i<=5;i++)
{
for(q=1;q<=32;q++)
printf(" ");
for(j=i;j<5;j++)
printf(" ");
for(s=t,p=1;s<=9;s++,p++)
printf("%d",p);
printf("\n");
t-=2;
}
t=3;
for(i=4;i>=1;i--)
{
for(q=1;q<=32;q++)
printf(" ");
for(j=i;j<5;j++)
printf(" ");
for(s=t,p=1;s<=9;s++,p++)
printf("%d",p);
printf("\n");
t+=2;
}

getch();
}

C | File Handling programs | Free Source Code | comments

 C | File Handling programs | Free Source Code | comments
C | File Handling  programs | Free Source Code | comments write the simple program for
file handling
#include<stdio.h>//header files//
void main()     
{                       ///start of main//

FILE *f1,*f2,*f3;     //pointers//
char c;
clrscr();                  // clear the screen//

printf("input text");
f1=fopen("cmb.txt","w");   //open file//
f2=fopen("cmb01.txt","w");
f3=fopen("cmb02.txt","a");
while((c=getchar()) != EOF)
putc(c,f1);                   //copy from one to another//
f1=fopen("cmb.txt","r");
while((c=getc(f1)) !=EOF)
printf("%c",c);                    
fclose(f1);
while((c=getchar()) != EOF) // use while loop for condition//
putc(c,f2);
fclose(f2);
f2=fopen("cmb01.txt","r");
while((c=getc(f2)) !=EOF)   //till not end of file//
printf("%c",c);                  // print all;l the data//

fclose(f1);                 //close the file//
fclose(f2);

file using file program in c

 file using file program in c
with the help of pointer this program shows to open abc.txt
file using file program in c
#include<stdio.h>      // HEADER FILES//
#include<conio.h>
main()                  //main start//
{
FILE * fp;                                 
char ch;
clrscr();
fp=fopen("abc.txt","r");
if(fp==NULL)            //if file is null//
{
printf("error");
getch();
}
while(1)
{
ch=fgetc(fp);
if(ch==EOF)
break;
printf("%c",ch);
}
fclose(fp);
getch();
}

C command line program code using argv using for loopExample

 C command line program code using argv using for loopExample
 C command line program code using argv  using for loop 
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main(int argc,char*argv[])
{
 int i,p=1;
// clrscr();
 if(argc!=3)
 {
 printf("\nerror");
 exit(1);
 }
 for(i=1;i<=atoi(argv[2]);i++);
  {
  p=p*atoi(argv[1]);
  printf("%d",p);

  }
  getch();
 }
examples for C command line program code using argv  using for loop

C command line program code using argv Example

 C command line program code using argv Example
c command line program code using argv
#include<stdio.h>
void main( int arge,char *argv[])
{
 FILE * fp;
 int i;
 char word[15];
 fp=fopen(argv[1],"w");
 printf("\nNo.of argument in command line=%d\n\n",arge);
 for(i=2;i<arge;i++)
 fprintf(fp,"%s",argv[i]);
 fclose(fp);
 printf("contents of %s file\n\n",argv[1]);
 fp=fopen(argv[1],"r");
 for(i=2;i<arge;i++);
{
 fscanf(fp,"%s",word);
 printf("%s",word);
 }
 fclose(fp);
 printf("\n\n");
 for(i=0;i<arge;i++)
 printf("%*s \n",i*5,argv[i]);
 }
Example for:-c command line program code using argv

C file programs using array command line

 C file programs using array command line
C file programs  using array command line
#include<stdio.h>
#include<conio.h>
void main(int argc,char*argv[])
{
 FILE *filep;
 int i;
 clrscr();
 printf("\nNumber of argument on command line =%d\n",argc);
 if(!argc<2)
 {
 printf("Arguments on the command line:\n");
 for(i=0;i<=argc;i++)
 printf("argv[%d]=%s\n",i,argv[i]);
 }
 else
 {
  printf("\nNo parameter on the command line");
  }
  getch();
 }
programming code for C file programs  using array command line

C command line program code using argv if -else loop

 C command line program code using argv if -else loop
C command line program code using argv if -else loop
#include<stdio.h>
#include<conio.h>
void main(int argc,char*argv[])
{
 FILE *fp;
 char s[100];
 clrscr();
 printf("\nNumber of argument on command line =%d\n",argc);
 if(argc<2)
 {
 printf("forget the file name\n");
  }
 else
 {
  printf("\nNo parameter on the command line");
  }
  getch();
 }
Examples for C command line program code using argv if -else loop

C program code | file handling with fopen using while loop

 C program code | file handling with fopen using while loop
C program code     | file handling  with fopen using while loop
#include<stdio.h>
void main()
{
 FILE *f1,*f2,*f3;
 char c;
 clrscr();
 printf("input text");
 f1=fopen("cmb.txt","w");
 f2=fopen("cmb01.txt","w");
 f3=fopen("cmb02.txt","a");
 while((c=getchar()) != EOF)
 putc(c,f1);
 f1=fopen("cmb.txt","r");
 while((c=getc(f1)) !=EOF)
 printf("%c",c);
 fclose(f1);
 while((c=getchar()) != EOF)
 putc(c,f2);
 fclose(f2);
 f2=fopen("cmb01.txt","r");
 while((c=getc(f2)) !=EOF)
 printf("%c",c);
 fclose(f1);
 fclose(f2);

 }
programming example for C program code     | file handling  with fopen using while loop

C program for file code ,fputs(),fflush,strcpy,strcmp using for loop sort alphabetically Float datatype in c , Example

C program for file code ,fputs(),fflush,strcpy,strcmp using for loop sort alphabetically Float datatype in c , Example
   c program for file code ,fputs(),fflush,strcpy,strcmp using for loop
#include<stdio.h>
void main()
{
 FILE *f,*q;
 char any;
 char nm[20],t[20];
 char m[20][20];
 int i,j,n;
 clrscr();
 f=fopen("e:\names.txt","w");
 do
 {
  fflush(stdin);
  printf("\n Enter a name");
  gets(nm);
  fputs(nm,f);
  fputs("\n",f);
  fflush(stdin);
  any=getchar();
  }while(any=='y');
  fclose(f);
  f=fopen("e:\names.txt","r");
  q=fopen("e:\sorted.txt","w");
  n=0;
  while(!feof(f))
  {
   fgets(nm,20,f);
   if(feof(f))
   break;
   strcpy(m[n],nm);
   n++;
   }
   fclose(f);
   printf("\n list of students");
   for(j=0;j<1;j++)
   puts(m[j]);
   for(i=0;i<n-1;i++)
   {
   for(j=i+1;j<n;j++)
   {
    if(strcmp(m[i],m[j]>0) )
    {
     strcpy(t,m[i]);
     strcpy(m[i],m[j]);
     strcpy(m[j],t);
     }
     }
     }
     printf("\n sorted alphabetically...\n");
     for(j=0;j<n;j++)
     {
      puts(m[j]);
      fputs(m[j],q);
      }
      fclose(q);
      getch();
      }

Heap Sort for sorting array in ascending Order

 Heap Sort for sorting array in ascending Order
Program for sorting an array in ascending order using heap sort
#include<conio.h>
#include<stdio.h>
void create(int[]);
void down_adjust(int[],int);
void main()
{
int heap[30],n,i,last,temp;
printf("\nEnter no. of elements :");
scanf("%d",&n);
printf("\nEnter the data to be sort :");
for(i=1;i<=n;i++)
scanf("%d",&heap[i]);
//create a heap
heap[0]=n;
create(heap);
//sorting
while(heap[0] > 1)
{
//swap heap[1] and heap[last]
last=heap[0];
temp=heap[1];
heap[1]=heap[last];
heap[last]=temp;
heap[0]--;
down_adjust(heap,1);
}
//print sorted data
printf("\nsorted data is :");
for(i=1;i<=n;i++)
printf("%d\t",heap[i]);
}
void create(int heap[])
{
int i,n;n=heap[0]; //no. of elements
for(i=n/2;i>=1;i--)
down_adjust(heap,i);
}
void down_adjust(int heap[],int i)
{
int j,temp,n,flag=1;
n=heap[0];
while(2*i<=n && flag==1)
{
j=2*i;  //j points to left child
if(j+1<=n && heap[j+1] > heap[j])
j=j+1;
if(heap[i] > heap[j])
flag=0;
else
{
temp=heap[i];
heap[i]=heap[j];
heap[j]=temp;
i=j;
}
}
}

sorted data is :20      67      96*/

find out ascii value of given number using while loop and for loop , example

 find out ascii value of given number using while loop and for loop , example
 find out ascii value of given number using while loop and for loop , example

how to write  program for find out ascii value of the given  number
# include<stdio.h>
void main()
{
  int n=1;
  clrscr();
  while(n<255)
  {
    printf("\t%d\t%c",n,n);
    n++;
  }
  getch();
}


second example

#include<stdio.h>
void main()
{
 int i;
 clrscr();
 for(i=1;i<=100;i++)
 {
  printf(" %d\t %c",i,i);
 }
 getch();
}

Array deletion | delete array in element in c program

Array deletion | delete array in element in c program
 Delete element of array

simple pogram how to Delete element of array
#include<stdio.h>
#include<conio.h>

void main()
{
int a[10],p,i,j;
clrscr();
printf("Enter ten element in array\n");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
printf("Enter position to delete element of array\n");
scanf("%d",&p);
for(i=0;i<p-1;i++)
{}
for(;i<9;i++)
a[i]=a[i+1];
printf("Resultant arry\n");
for(i=0;i<9;i++)
printf("%d  ",a[i]);
getch();
}

c program | array code| if loop examples

c program | array code| if loop examples
 C program code for array program using if loop , example

how to  write c program code for array program using if loop
 #include<stdio.h>
void main()
{
   int i,j=0,no[5];
  clrscr();
   printf("Enter Elements In Array:=");
    for(i=1;i<=5;i++)
   {
     scanf("%d",&no[i]);
    if (no[i]>50)
      j++;
   }
   printf("In Array There are No. >50's:= %d",j);
     getch();
  }
examples of array program using if loop

Array Reverse | c program array reverse

Array Reverse | c program array reverse
 Array reverse c code

Array reverse c code/
* reverse.c */
/* Prints an input sequence backwards. */
#include
#define SIZE 20

int main() {
int i, n;
int nums[SIZE];

/* Read numbers into array. */
/* Stop when 0 is found */
for (n = 0; n < SIZE; ++n)
 {
 int input;
scanf("%d", &input);
 if (input == 0)
 break;
nums[n] = input;
}
for (i = n-1; i >= 0; --i)
printf("%d ", nums[i]);
return 0;
}
code for array reverse

Max Array examples in c program | c program array

Max Array examples in c program | c program array
 Array max code , Example

Array max code
#include<stdio.h>
int max(int a[]);
void main()
{
  int a[10],i,ans;
  clrscr();
  printf("\nEnter 10 elements in array:");
  for(i=0;i<10;i++)
  scanf("%d",&a[i]);
  ans=max(a);
  printf("\n Max element of array:%d",ans);
  getch();
}
int max(int a[])
{
  int j,m=0;
  for(j=0;j<10;j++)
  {
    if(a[j]>m)
    m=a[j];
  }
  return(m);
code for Array max

C program addition of array | Array Addition in c language

C program addition of array | Array Addition in c language
 Addition of two array using define , Example

Addition of two array using define
#include
#define m 10
#define n 10
void main()
{
int a[m][n],i,j,x,y;
clrscr();
printf("\nEnter number of rows and columns");
scanf("%d%d",&x,&y);
for(i=0;i
{
for(j=0;j
scanf("%d",&a[i][j]);
}
printf("\n\n\n");
for(i=0;i
{
for(j=0;j
{
printf(" %d",a[i][j]);
}
printf("\n\n");
}
}
Addition of two array using define in c code

c program for sorting of arrays in descending order

 c program for sorting of arrays in descending order
 c program for sorting of arrays in descending order
How to write a program for sort  numbers in c code descending order
#include<stdio.h>
void sort(int a[]);
void main()
{
  int a[10],i;
  clrscr();
  printf("\nEnter 10 elements in array:");
  for(i=0;i<10;i++)
  scanf("%d",&a[i]);
  sort(a);
}
void sort(int a[10])
{
  int temp,i,j;
  printf("\nArray in Ascending Order:");
  for(i=0;i<10;i++)
  for(j=i+1;j<10;j++)
  {
     if(a[i]>a[j])
     {
       temp=a[i];
       a[i]=a[j];
       a[j]=temp;
     }
  }
  for(i=0;i<10;i++)
  printf("%d  ",a[i]);
  printf("\n\nArray in Descending Order:");
  for(i=9;i>=0;i--)
  printf("%d  ",a[i]);
}
array  sort examples

DropdownList and checkbox control in Asp.Net

DropdownList and checkbox control in Asp.Net
DropdownList and checkbox control in Asp.Net examples

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click1(object sender, EventArgs e)
{
Label3.Text = "you have selected:" + DropDownList1.SelectedItem.Text;
}
}


checkbox


public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string str = "your choice is:";
if (Apple.Checked == true)
str += Apple.Text+"|";
if (Mango.Checked == true)
str += Mango.Text+"|";
if (Banana.Checked == true)
str += Banana.Text +"|";
if (Graps.Checked == true)
str += Graps.Text +"|";
Label1.Text = str;
if(str=="your choice is:")
Label1.Text = "select choice then submit";
}
}

Difference between tml control | server control with examples in asp.net

Difference between tml control | server control with examples in asp.net

asp.net controls | html control | server control with examples code
1)default = the class name by default defined in System.Web.UI.Page
2)default.aspx = it is class internally and it derived from

System.Web.UI.Page


Controls in asp.net

1) asp .net supports two types control
i)Html server control
ii)Server side control
i)Html server control:-This control we use for migration purpose.
ii)These controls are defined in System.Web.UI.HtmlControls;


2)Server side controls :- These are xml based controls
i)These controls are defined in System.Web.UI.WebControls; web page
ii) web server controls can communicate web server directly.
iii)In asp .net by default your page will be submit using post method.

examples with code


using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("we are in new page");
}
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = "asp.net event programming";


}
protected void Button2_Click(object sender, EventArgs e)
{
//Response.Redirect("default1.aspx");
Server.Transfer("default2.aspx");
}
}

Try And Catch asp.net | How to write code

 Try And Catch asp.net | How to write code
 Try And Catch asp.net | How to write code

Asp.net program code for Sale system with output
using System;


using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void orderbtn_Click(object sender, EventArgs e)
{
int p = 0, q = 0, d = 0;
float amt = 0;
String n = "";
try
{
n = this.txtname.Text;
p = int.Parse(txtprice.Text);
q = int.Parse(txtquantity.Text);
d = int.Parse(txtdiscount.Text);
amt = p * q*(1 - d / 100f);
lblnm.Visible = true;
lblnm.Text = "you have purchased " + q + "units of " + n + "at the price of " + d + "and you have to pay Rs" + amt;
}
catch (Exception ex)
{
lblnm.Visible = true;
lblnm.Text = "error occurs please renter the data";
}
}
protected void clearbtn_Click(object sender, EventArgs e)
{
txtname.Text = "";
txtprice.Text = "";
txtquantity.Text = "";
txtdiscount.Text = "";
lblnm.Visible = false;
}
}

Difference between Response.Redirect , Server.Transfer

Difference between Response.Redirect , Server.Transfer

asp.net | Response.Redirect |  Server.Transfer method using program code source

Asp.net supports only one form  at the server side.
Redirection page:-if we want  to navigate from one page to another
page we have to use following method.
1)Response.Redirect
2)Server.Transfer

create new form in asp.net
craete a new asp.net website from the solution explorer and add new

item for web.Form

page Load:-

Response.Redirect ();

-we can find destination file name  at the url i.e

this file displaying by the browser destination.

Server Transfer:-
this file is displaying by the web server because of this  we can not find
destination file name at the url.


using System;

public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("we are in new page");
}
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = "asp.net event programming";


}
protected void Button2_Click(object sender, EventArgs e)
{
//Response.Redirect("default1.aspx");
Server.Transfer("default2.aspx");
}
}
1) run this program with help of two button and one text box
2) when you will click on button 1 then message will come on text box

and if you will click on the button 2 then it will give msg on page load .
i.e "we are in new page ".
when click on button one then

TextBox1.Text = "asp.net event programming"; this will work

means "asp.net event programming"; this msg will appear in the text

box 1.
3) if  you will execeute both then problem comes in

//Response.Redirect("default1.aspx"); this line.

we wrote there on page load msg will come on screen it means it
transfer same msg using Server transfer. asfter click on button 2 it will
give msg what we have seen on page load.

well something for work?
find out meaning of this line.....
object sender, EventArgs e?

nullReferenceException was unhandled

 nullReferenceException was unhandled
If you are  facing error like
nullReferenceException  was unhandled by user id
 then you have to check  your  APP   name and connection string
check your web.congfig file

<connectionStrings>
    <add name="connect" connectionString="Data Source=pc_name\SQLEXPRESS;Initial Catalog=stud;Integrated Security=True"/>
  </connectionStrings>
Add name and  again back to code behind on page load and check this line
  string conStr = WebConfigurationManager.ConnectionStrings["stud"].ConnectionString;
    SqlConnection con = new SqlConnection();
In the place of stud that I sactually my database name write add name that is
Add name=”connect” replace with “stud”

How to embed alert box into asp.net using c#

 How to embed alert box into asp.net using c#
How to embed alert confirm messagebox box into asp.net using c# | confirm box in Asp.net Using c#

<asp:button id="print" runat="server" text="Print" commandname="Print" OnClientClick="return confirm('Are you sure want to print record');" Width="40px" onclick="print_Click" />
By using CommandName and OnClientClick we can embed or use alert box in asp.net

How to embed .ascx page to .aspx page in asp.net code inline

How to embed .ascx page to .aspx page in asp.net code inline
To embed .ascx page in .aspx page just remember to few points.
1->create .ascx page in Application .
2->write TagName , TagPrefix at the time of register.
3->then call that code in a page where you want to display.
4->How to use TagName and TagPrefix
<%@ Register Src="~/folder name/filname.ascx" TagName="userTagName" TagPrefix="nameofTagprefix"%>

then at the time of calling

<nameoftagprefix:usertagname runat="server" id="Idof tag"></nameoftagprefix:usertagname>


examples:--
<search:clentsearch id="cldsrch" runat="server"></search:clentsearch>

JavaScript in Asp.net with source code using ContentPlaceHolder

JavaScript in Asp.net with source code using ContentPlaceHolder
How to write javascript code in asp.net

<asp:Content ID="Content3" ContentPlaceHolderID="head" runat="server">

<script language="javascript" type="text/javascript" src="../foldername/jsfile.js">
</script>
<script language="javascript" type="text/javascript">
function alertMe()
{
alert("hi How are u!")
}
</script>

<style type="text/css">
#buttonIcon
{
width: 66px;
}
</style>
</asp:Content>

Armstrong Number in c++ cplus plus(cpp) with source code

Armstrong Number in c++  cplus plus(cpp) with source code
How to write A Program for  Armstrong Number.
before to start this program just get the definition of Armstrong number .
like (153=1*1*1+5*5*5+3*3*3).left side value is equal to the right side value then number is called Armstrong number.else number is not Armstrong number
class arm
{
int n;
public: arm();
void display();
};
void arm::arm()
{
cout<<"\n a=";
cin>>n;
}
void arm::display()
{
int sum=0,r;
int a=n;
while(n>0)
{
r=n%10;
n=n/10;
sum=sum+(r*r*r);
}
if(a==sum)
cout<<"armstrong";
else cout<<"not armstrong";
}
void main()
{
arm ob;
clrscr();
ob.display();
getch();
}