Friday 28 September 2012

Validation Controls in ASP.net

ASP.Net provides validation controls which a rich amount
of validation services that saves your work to make
java script code because at a huge level java script is used to validate client side
validation. for perform validation using java script you must have knowledge of
java script.
But you can perform powerful validation using ASP.net Validation
Controls with knowledge of java script..

RequiredFieldValidator Control

Evaluates the value of an input control to ensure that the user enters a value.
Use the RequiredFieldValidator control to make an input control a mandatory field. The input control fails validation if the value it contains does not change from its initial value when validation is performed. This prevents the user from leaving the associated input control unchanged. By default, the initial value is an empty string (""), which indicates that a value must be entered in the input control for it to pass validation.

Controls :
  • Textbox
  • ASP Button
  • Requirefield Validater
  • Label
Property :
         RequiredFieldValidator
  • ControlToValidate="TextBox1"
  • ErrorMessage="*" 
Aspx page code 
<form id="form1" runat="server">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 
;<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
            ControlToValidate="TextBox1" ErrorMessage="*"></asp:RequiredFieldValidator>

<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Save" />
<asp:Label ID="Label1" runat="server"></asp:Label> 
</form>

Server Side code :
protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text = "Running Server code";
    }


RangeValidator Control 


Evaluates the value of an input control to determine whether it is between the specified upper and lower boundaries.
The RangeValidator control allows you to check whether a user's entry is between a specified upper and a specified lower boundary. You can check ranges within pairs of numbers, alphabetic characters, and dates. Boundaries are expressed as constants.

Print a character in Notepad,Excel,Power Point using ASCII code

Notepad is windows platform text editor.
You can enter value in notepad within a ASCII range
but You can also provide input using ASCII code
because keyboard has not all key which can print all ASCII Code
Steps 
  • Press ASCII character with alt key
  • make sure num lock is on
  • because you can provide ASCII only using numeric key......

How to make Numeric,String textbox and many more on a webpage using java script

Here i'm showing code which help you to make
a textbox which can only accept number.
This is helpful when you're making texbox which takes number as input
This solution works in both IE and Mozilla.
Numeric  Textbox..
HTML Code :
<html>
<head >
    <title>Girfa Numeric Textbox Demo</title>
   
    <script language="javascript">
        function validatenumber(evt)
        {
           
          var ch = (evt.which) ? evt.which : event.keyCode
          if(ch > 31 && (ch < 48 || ch > 57))         
            return false;
                   
          return true;                     
            
        }

Thursday 27 September 2012

How to make popup menu in VB 6.0

Hi...
Popup menu is menu which appeared when we right click from mouse
on a form. You can see it when you right click on desktop a menu appeared
which is pop menu.
There're many uses of popup menu in windows development
Popup menu provide many flexible option front of user its really make
an application more user friendly because user choose their option frequently


   as you can see in image that you must make a menu and make it visible property false
otherwise it'll not appear on form.
You have to visible it on mouse right click . So we can use form mouse up event.
For Detect right click button of mouse you can use Button value which initialize by event handler
if button value is 2 then its rdenotes right click otherwise 1 if user clicked on left button
Now you can make its visibility true as in code....

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 2 Then
        PopupMenu mnedit
    End If
 
End Sub

How to print background color and image on paper in word 2003 and 2007

In default setting of word you can't print background color and image of
a page on a paper.But you can do it by changing some property take a look

Print Background color,image in word 2007
  • Select word option from Office button
  • Select Display
  • Check Print background colors and images
  • Click ok

Change case of text in Excel 2003 and Excel 2007

There'are many situation when we want change case of text in excel after data entry.
There may a huge amount of text within a column which you want to  change.
you can use excel function upper,lower and proper how? Take a look..

Change Text Case in excel 2007




  • Enter your text As in image
  • select column near of your text cell as in image
  •  If There is not  space for a column then right click select insert and add entire column
  • Enter Formula as you want apply
      e.g. =upper(b1) 
      drag it down side
  • Now Select change text and copy it
  • Click on cell where actual change has to be done
  • Highlight Home from ribbon control select paste and pick paste values
  • Now you can delete column which had add...

Tree Using Opration Using C language

Tree

a tree is a widely used data structure that simulates a hierarchical tree structure with a set of linked nodes.
A tree can be defined recursively (locally) as a collection of nodes (starting at a root node), where each node is a data structure consisting of a value, together with a list of nodes (the "children"), with the constraints that no node is duplicated. A tree can be defined abstractly as a whole (globally) as an ordered tree

Menu based program for tree operation (Add,Delete,inorder,preorder,postorder print).

#include<stdio.h>
#include<conio.h>
/* Tree Implementation
   By Girfa
   Do not use it on any other website
   */
typedef struct st_tree
{
    struct st_tree *left;
    int data;
    struct st_tree *right;
}tree;
/* Function Prototype */
tree* create(int);
void insert(int n,tree **);
void inorder(tree *);
void preorder(tree *);
void postorder(tree*);
void del(int,tree **);
void main()
{
    tree *root=NULL;
    int n,s,opt;

Wednesday 26 September 2012

HIDDEN PROGRAME IN WINDOW XP

Is it strange to hear , but true that some good programs are hidden in Windows XP !!!


Programs :

1. Private Character Editor :

Used for editing fonts,etc.
** start>>Run
** Now, type eudcedit

2. Dr. Watson :

This an inbuilt windows repairing software !
** start>>Run
** Now, type drwtsn32

3. Media Player 5.1 :

Even if you upgrade your Media Player, you can still access your old player in case the new one fails !!!
** start>>Run
** Now, type mplay32

4. iExpress :

Used to create SetupsYou can create your own installers !
** start>>Run
** Now, type iexpress

Tuesday 25 September 2012

Double Link List Using C Language

Double Link List..

a doubly linked list is a linked data structure that consists of a set of sequentially linked records called nodes. Each node contains two fields, called links, that are references to the previous and to the next node in the sequence of nodes. The beginning and ending nodes' previous and next links, respectively, point to some kind of terminator

Advantage

A doubly linked list can be traversed in both directions (forward and backward). A singly linked list can only be traversed in one direction. 

A node on a doubly linked list may be deleted with little trouble, since we have pointers to the previous and next nodes. A node on a singly linked list cannot be removed unless we have the pointer to its predecessor.
On the flip side however, a doubly linked list needs more operations while inserting or deleting and it needs more space (to store the extra pointer).
Implementation: Complete menu base code
#include<stdio.h>
#include<conio.h>
/*   Double Link List Example
     Developed By Girfa
     do not use it on any other website
*/
typedef struct st_dlist
{
struct st_list *pre;
int data;]
struct st_list *next;
}dnode;
/* Function Prototype */
dnode * create(int);
void addbegin(int,dnode**,dnode**);
void addlast(int,dnode**,dnode**);
void addbefore(int,int,dnode**,dnode**);
void addafter(int,int,dnode**,dnode**);
void del(int,dnode**,dnode**);
void print(dnode*);
void main()
{
dnode *head=NULL,*tail=NULL;
int n,s,opt;

Queue Using Single Link List Using C Language

Queue

a queue is a particular kind of abstract data type or collection in which the entities in the collection are kept in order and the principal (or only) operations on the collection are the addition of entities to the rear terminal position and removal of entities from the front terminal position. This makes the queue a First-In-First-Out (FIFO) data structure. In a FIFO data structure, the first element added to the queue will be the first one to be removed.

Queue Implementation Using Single link list

#include<stdio.h>
#include<conio.h>
/* Queue Implementation using single link list
   Develop By Girfa
   do not use it on any other website
*/
typedef struct st_que
{
int data;
struct st_que *next;
}que;
/* Function Prototype */
que* create(int);
void enque(int,que **,que **);
void deque(que**,que**);
void print(que*);

Stack Operation using C Language


Stack......
a stack is an area of memory that holds all local variables and parameters used by any function
One way of describing the stack is as a last in, first out (LIFO)
The push operation adds a new item to the top of the stack, or initializes the stack if it is empty
 If the stack is full and does not contain enough space to accept the given item, the stack is then considered to be in an overflow state. The pop operation removes an item from the top of the stack. A pop either reveals previously concealed items, or results in an empty stack, but if the stack is empty then it goes into underflow state (It means no items are present in stack to be removed)


Stack Operation Using Single Link List 

#include<stdio.h>
#include<conio.h>
typedef struct st_stack
{
int data;
struct st_stack *next;
}stack;
/* Function Prototype */
stack* create(int);
void push(stack**,int);
void pop(stack**);
void print(stack*);
void main()
{
stack *start=NULL;
int n,s,opt;

Monday 24 September 2012

Singal Link List Operation using C Language


In computer science, a linked listis a data structure consisting of a group of nodes which together represent a sequence. Under the simplest form, each node is composed of a datum and a reference (in other words, a link) to the next node in the sequence; more complex variants add additional links. This structure allows for efficient insertion or removal of elements from any position in the sequence.
#include<stdio.h>
#include<conio.h>
typedef struct st_tag
{
int data;
struct st_tag *next;
}node;
/* Function Prototype */
node* create(int);
void addbegin(node**,int);
void addlast(node**,int);
void addbefore(node**,int,int);
void addafter(node**,int,int);
void del(int,node**);
void print(node*);
void main()
{
node *start=NULL;
int n,s,opt;

Saturday 22 September 2012

Database operation ASP.net using SQL Server 2000


The ADO.NET architecture is designed to make life easier for both the application developer and the database provider. To the developer, it presents a set of abstract classes that define a common set of methods and properties that can be used to access any data source. The data source is treated as an abstract entity, much like a drawing surface is to the GDI+ classes.


Controls :
  • Three Textbox
  • Three Button
  • One GridView
  • SqlDataSource




Setting Gridview : 
  • Add Gridview select auto format if you want to use available style for gridview select a style click ok
  • Choose data source select < New Data source.. >
  • Select Database from Configuration Wizard 
  • Click New Connection and change database type from Add Connection wizard
  • Choose SQL Server click ok
  • Enter Server name I have have used . for local client server
  • Select Database Click ok
  • Select check your connection string and click next
  • Select your table and fields which you want to show on Gridview
Coding :
 SqlConnection con;
    SqlCommand com;
    protected void Page_Load(object sender, EventArgs e)
    {
        con = new SqlConnection("initial catalog=bsw;data source=.;integrated security=true");
        com = com = new SqlCommand();
        com.Connection = con;
    }

Timer In ASP.Net Using AJAX

With the help of AJAX we can postback an specific  part of a web part.
Normally when we click on a control which has capability to postback its load entire
page which time and data consuming both.You can save your time and data cost both
With Ajax
Controls..

  • ScriptManager
  • UpdatePanel
  • Timer
  • Label
ASP Source code *.aspx


<form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
            <asp:Timer ID="Timer1" runat="server" Interval="1000" ontick="Timer1_Tick">
            </asp:Timer>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>
Server side code *.aspx.cs


public partial class _Default : System.Web.UI.Page
{
    static int i;
    
    protected void Timer1_Tick(object sender, EventArgs e)
    {
        i++;
        Label1.Text = i.ToString();
    }
}

How to make search box on your web site


Google provide a custom search box which make you able to
search content on your website with the help of Google custom search box
just paste this code on your website where you want to place it...........

<form action="http://www.google.com/cse" id="cse-search-box" target="_self">
  <div>    
    <input type="hidden" name="ie" value="ISO-8859-1" />
    <input type="text" name="q" size="25" /><br />
    <input type="submit" name="sa" value="Search" class="formoutput"/>
  </div>
</form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&amp;lang=en"></script>

Friday 21 September 2012

Database Operation in Visual C#

Controls
  • Three TextBox
  • Three Button
  • One Data GridView


Setting DataGridView..
  • Click Datagridview task An Arrow right top side of Gridview
  • Choose Data Source
  • Add Project Data Source
  • Select Database from Configuration Wizard Click Next
  • Click New Connection Click change from add connection wizard,select Microsoft Access Database file from  change data source wizard click ok
  • Browse your database mdb file from your computer, Test Connection > Ok >click next from configuration wizard
  • Visual studio prompt you to add your database in current project if you want to add click yes otherwise on
  • Select table from configuratiob wizard select your table and check fields which you want show in Datagridview and finish




using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace AccessDemo
{
    public partial class Form1 : Form
    {
        OleDbConnection con = new OleDbConnection(@"provider=microsoft.jet.oledb.4.0;data source=D:\Raj\c#\Database\bsw.mdb");
        OleDbCommand com = new OleDbCommand();
        public Form1()
        {
            try
            {
                con.Open();
                com.Connection = con;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            InitializeComponent();
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtRoll.Text == "" || txtName.Text == "" || txtCity.Text == "")
            {
                MessageBox.Show("Please fill all field properly");
            }
            else
            {
                             
                try
                {
               
                    com.CommandText = "insert into stu values(" + txtRoll.Text + ",'" + txtName.Text + "','" + txtCity.Text + "')";
                    com.ExecuteNonQuery();
                    MessageBox.Show("saved");
                    this.stuTableAdapter.Fill(this.bswDataSet.stu);

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
         

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'bswDataSet.stu' table. You can move, or remove it, as needed.
            this.stuTableAdapter.Fill(this.bswDataSet.stu);

        }

RollOver Feature on an Image in your website

Rollover is a feature in this effect when you move mouse on a
image then image change on that button instantly.This is possible with the help combination
of java script and css using inline mode



     <img src=a1.jpg height=100px width=100px
        onmouseover="this.src='a2.jpg'"
        onmouseout="this.src='a1.jpg'" />

   <img src=a1.jpg height=100px width=100px
        onmouseover="this.src='a2.jpg';this.style.border='outset 5px blue'"
        onmouseout="this.src='a1.jpg';this.style.border=''" />
     

RollOver and RollOut Effect on Button in a Website


<input type="button" value=" Girfa : Student Help " id="b1"    
      onmouseover="this.style.fontWeight='bold';"
      onmouseout="this.style.fontWeight='normal'";
      />


<input type="button" value=" Girfa : Student Help " id="b1"
      style="background-color:'blue'"
      onmouseover="this.style.backgroundColor='aqua';"
      onmouseout="this.style.backgroundColor='blue'";
      />



<input type="button" value="Girfa : Student Help"
      onmouseover="this.style.color='Blue';this.style.backgroundColor='yellow';this.style.border='outset 3px red'"
      onmouseout="this.style.color='';this.style.backgroundColor='';this.style.border=''" />


DLL in VB 6.0,VB.Net,C#

Hi......
DLL statds for Dynamic Link Library which comprise Business logic .At A huge level of 
Software development it is suitable to implement business login separately. 
DLL provides facility of reversibility means  ones you have been created a DLL 
for a task then many project can use your DLL, Like if you have a DLL of
Calculator logic then many Application can use it after importing DLL ij their project...

DLL in VB 6.0
  • Open VB 6.0 and select ActiveXdll
  • Change your final project name as you're going to make otherwise you may be face problem of name contradiction because default name of dll project is Project 1 and VB Standard exe has also same so change name of dll project or standard exe project
  • On Project explorer window change of class1 as your requirement
  • now make some procedure and function of your logic as showing in following picture
  • Save DLL project
  • For make DLL select File > Make Project1 DLL...
  • Now your DLL is ready to use
Develop by Raj Kumar

How to use This DLL
  • Open VB 6.0
  • Select Standard EXE
  • For add a DLL in your project ..
  • Go to Project > Refereneces.
  • Browse Your DLL File and click open
  • Now you can use DLL class
  • Make an object of class which you have made in your DLL project
  • Call function of your DLL class using . operator
After import DLL you can use it at anywhere here is code which you can use on a button click event

Private Sub Command1_Click()
    Dim ob As New Class1
    ob.Show
    
End Sub

Private Sub Command2_Click()
    Dim ob As New Class1
    MsgBox (ob.Sum(10, 20))
End Sub
DLL in C# and VB.Net

  • Open Visual studio 2008 File > Project > Select class library form template
  • Implement your function and logic inside class body
  • After implementing logic press f6 for build your DLL Project
  • For use a DLL in windows Application right click of root folder from solution explorer
  • Add References..
  • Browse your project DLL
  • Now make an object of class which you have named in DLL file
Code of DLL my DLL file

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ClassLibrary1
{
    public class Class1
    {
        public int sum(int a,int b)
        {
            return a + b;
        }
    }
}

Thursday 20 September 2012

Zig Zag Effect on text and image using MARQUEE


Marquee is a  HTML tag which is use scroll object inseide it.
You can scroll any thing in body of marquee. Marquee tag has property direction which moves
and object(left,right,up,down) , Behavior property change behavior of scrolling.....
You can put image instead of <h1> or any thing which you want to move in a zigzag way... Enjoy marquee.

Girfa : Student Help

<marquee behavior=alternate>
        <marquee direction=down behavior=alternate>
            <marquee direction=up behavior=alternate>
                <h1>Girfa : Student Help</h1>
            </marquee>
        </marquee>       
   </marquee>