Sunday, 25 December 2011

Get List Of All Printers


To Getting List of All Printers First of all add a namespace
System.Drawing.Printing

use Foreach Loop:

foreach(string printer in PrinterSettings.InstalledPrinters)
{
Combobox1.Items.Add(Printer.ToString());
}

using this you get list of all printer install on your system

Saturday, 24 December 2011

Select Second Maximum From a Table in Sql

Q.Find Second Maximum From a Table in Sql

select max(duration) from course where duration<(select max(duration) from course)

OR



select min(duration) from course where duration in(select top 2 duration from course)

Wednesday, 7 December 2011

EditTable Listbox


To create a edittable list box take a list box and enter items in it.now select the list box double click event from event list.

private void listBox1_DoubleClick(object sender, EventArgs e)
{
//get list item index
int itemno = this.listBox1.SelectedIndex;
//get list item tex;
string itemvalue = this.listBox1.Items[itemno].ToString();
Rectangle rect = this.listBox1.GetItemRectangle(itemno);
this.textBox1.BackColor = Color.Aqua;
this.textBox1.BorderStyle = BorderStyle.Fixed3D;
//get list item drawing point
this.textBox1.Location = new System.Drawing.Point(rect.X + 12, rect.Y + 12);
this.textBox1.Size = new System.Drawing.Size(rect.Width + 5, rect.Height - 5);
this.textBox1.Visible = true;
this.textBox1.Text = itemvalue;
this.textBox1.Focus();
this.textBox1.SelectAll();
}

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
//if User Press Enter button
if (e.KeyChar == 13)
{
this.listBox1.Items[this.listBox1.SelectedIndex] = this.textBox1.Text;
this.textBox1.Visible = false;
}
//If User press Escape button
if (e.KeyChar == 27)
{

this.textBox1.Visible = false;
}
}

Tuesday, 22 November 2011

Interchange Values of Two numbers Without using third variable

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter First number=");
scanf("%d",&a);
printf("Enter Second number=");
scanf("%d",&b);
a=a+b;
b=a-b;
a=a-b;
printf("a is=%d\n",a);
printf("b is=%d",b);
getch();
}
Earn upto Rs. 9,000 pm checking Emails. Join now!

Interchange Values of Two numbers

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter First number=");
scanf("%d",&a);
printf("Enter Second number=");
scanf("%d",&b);
c=a;
a=b;
b=c;
printf("a is=%d\n",a);
printf("b is=%d",b);
getch();
}

 
Earn upto Rs. 9,000 pm checking Emails. Join now!

Monday, 21 November 2011

Write a Program to calculate area of a Rectangle

#include<conio.h>
#include<stdio.h>
void main()
{
int length,breadth,area_of_rectangle;
clrscr();
printf("Enter the Length=");
scanf("%d",&length);
printf("Enter the Breadth=");
scanf("%d",&breadth);
area_of_rectangle=length*breadth;
printf("Area of rectnagle is=%d",area_of_rectangle);
getch();
}

 

Write a Program to calculate area of a circle

#include<conio.h>
#include<stdio.h>
void main()
{
double radius,area_of_circle;
clrscr();
printf("Enter the radius=");
scanf("%lf",&radius);
area_of_circle=3.14*radius*radius;
printf("Area of Circle is=%lf",area_of_circle);
getch();
}

Tuesday, 15 November 2011

Sunday, 13 November 2011

If a five-digit number is input through the keyboard,write a program to reverse the number?

/*Reverse a Number*/
#include<stdio.h>
#include<conio.h>
void main()
{
int number,reverse_number;
clrscr();
printf("Enter the Number you want to reverse:");
scanf("%d",&number);
/*we use while loop and '%' to seprate a number*/
printf("Reverse number is:");
while(number>0)
{
reverse_number=number%10;
number=number/10;//update number
printf("%d",reverse_number);
}
getch();
}

If a five-digit number is input through the keyboard ,write a program to calculate the sum of its digit?

/*Sum of  Digit of  a Number*/
#include
#include
void main()
{
int number,sum=0;
clrscr();
printf("Enter the Number you want to Sum its digit:");
scanf("%d",&number);
/*we use while loop and '%' to separate a number*/
printf("Sum of its digit is:");
while(number>0)
{
sum=sum+(number%10);
number=number/10;//update number
}
printf("%d",sum);
getch();
}

Concept of Strong name

strong name is used for unique id for.net assembly. it is used when we need to deploy assembly in Gac(global Assembly cache).

How to generate Strong name


go to visual studio tools> Visual studio Command Prompt

There is command prompt window With

C:\program files\visual studio 9.0\Vc\

to create strong name type sn.exe -k "c:\test.snk"


C:\program files\visual studio 9.0\Vc\sn.exe -k "c:\test.snk"

-k is key value parameter and "c:\test.snk" is location to save file


after that press enter nd u get

key pair return to "path"

For using strong Name in Class library


in Visual Studio
go to Projects > Class library1 properties. > signing

make use a key radio button Checked nd browse Location of test.snk

nd use test.snk in your Class Library

Different Methods to Pass Values between Web Forms





Untitled Document





Different Methods to Pass Values between Web Forms

Cross page posting means to post data from one page to another page.this is an important concept in web development.

there are many methods to perform this task.some of Them are following.

Cookies:

A small piece of information or message sent by the web server to User's web browser during a request, which is stored on user's system in the form of a text file(mostly as notepad file).

How to use a cookie.

//Cross Page Posting Using Cookies.
HttpCookie samplecookie = new HttpCookie("mycookie");
  samplecookie.Value = TextBox1.Text;
  samplecookie.Expires = DateTime.Now.AddHours(1);
  Response.Cookies.Add(samplecookie);
  Response.Redirect("default2.aspx");
  

ON Second page

Retrive value using cookies.

Label1.Text = Request.Cookies["mycookie"].Value;

Query String

this is another way to pass value between pages.
in it we have to use a question mark (?) as separator. "&" is use to pass multiple query strings.

how to use querystring

Response.Redirect("default2.aspx?pass="+TextBox2.Text);

Retrieve value using Querystring

Label2.Text = Request.QueryString["pass"]

Sessions

it is server side state management method.this is most secure and most acceptable way of cross page posting

how to use session on page.



Session["user"] = txtName.Text;

on second page

string str=Session["user"].ToString();

Wednesday, 9 November 2011

Top Ten List of Ebook Websites

  1. FreeBookSpot(www.freebookspot.com)
  2. Free-eBooks(www.free-ebooks.net)
  3. GetFreeEBooks(www.getfreeebooks.com)
  4. Scribd(www.scribd.com)
  5. OnlineComputerBooks(www.onlinecomputerbooks.com
  6. FreeComputerBooks(freecomputerbooks.com)
  7. FreeTechBooks(www.freetechbooks.com)
  8. OnlineFreeEBooks(www.onlinefreeebooks.net)
  9. AskSam Ebooks(www.asksam.com/ebooks)
  10. eBookLobby(www.ebooklobby.com)