Thursday, 7 March 2013
Input a string in a Textbox and it Reverse string in C#
12:25
No comments
Input a string in a textbox and
reverse the string to display it in another textbox
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Reverse
{
public partial class Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
//Using by for loop............................
}
char[] ch;
private
void btnByForLoop_Click(object sender, EventArgs e)
{
string
ch = txtinputstring.Text;
txtoutputstring.Text = string.Empty;
for
(int i = ch.Length - 1; i >= 0; i--)
{
txtoutputstring.Text +=
ch[i].ToString();
}
//Using by function ............................
public string myrev(char[]
val)
{
string
total = string.Empty;
for
(int i = val.Length - 1; i >= 0; i--)
{
total += val[i].ToString();
}
return
total;
}
private
void BtnByFun_Click(object
sender, EventArgs e)
{
string
val = txtinputstring.Text;
txtoutputstring.Text =
myrev(val.ToCharArray());
}
//Using by ForEach Loop function
............................
private
void btnForEach_Click(object
sender, EventArgs e)
{
foreach
(char c in
txtinputstring.Text.ToCharArray())
{
txtoutputstring.Text = c +
txtoutputstring.Text;
}
}
}
Wednesday, 6 March 2013
How to create auto generate field,unique key,Foreign key with two tables in Sql Server 2008
09:23
No comments
How
to create Auto Generate,Unique key,Foreign key with two tables in Sql
Server 2008
create database
test
use test
create table
StudentInfo (RollNo
int identity(1,1) primary key ,Name nvarchar(50) unique,Course nvarchar(100)NOT NULL)
Create table
Books (
SrNo
int identity(1,1) primary key,BookName nvarchar(50),Quantity int,RollNo int foreign key references StudentInfo (RollNo))
Friday, 1 March 2013
create validation on TextBox Field,CheckBox,DropDown using Java Script
03:52
No comments
How to create validation
on TextBox Field,CheckBox,DropDown using JavaScript
**************************************************************
<html>
<head>
<script type="text/javascript">
function
val()
{
//alert("kush");
var un
= document.forms['myform']['username'].value;
var fn
= document.forms['myform']['fathername'].value;
var e1
= document.forms['myform']['email'].value;
var p =
document.forms['myform']['password'].value;
var cp
= document.forms['myform']['cpassword'].value;
var cs
= document.forms['myform']['city'].value;
if (un
== null || un == "")
{
alert('Please
enter user name');
return
false;
}
if (fn
== null || fn == "")
{
alert('Please
enter father name');
return
false;
}
if (e1
== null || e1 == "")
{
alert('Please
enter email name');
return
false;
}
if (p
== null || p == "")
{
alert('please
enter password');
return
false;
}
if (cp
== null || cp == "")
{
alert('please
enter confirm password');
return
false;
}
if (cs
== null || cs == "")
{
alert('Please
Select City');
return
false;
}
//coding for
how to validate checkbox List in Java Script............
var
chks = document.getElementsByName('qulification[]');
var
checkCount = 0;
for (var i = 0; i < chks.length; i++) {
if
(chks[i].checked) {
checkCount++;
}
}
if
(checkCount < 2) {
alert("Please
select at least two.");
return
false;
}
//coding for how to compare validate password and
Confirm Password in Java
Script............
if (p
!= cp) {
alert("Password
and Confirm Password is not match");
}
return true;
}
</script>
</head>
<body>
<form action="tiwari.html"
method="post"
name="myform"
onsubmit="return
val()">
<table border="5px"
width="100%">
<tr><td>Name:</td><td><input type="text" name="username"></td><td></td></tr>
<tr><td>Father Name</td><td><input type="text" name="fathername"></td><td></td></tr>
<tr><td>EmailId</td><td><input type="text" name="email"></td><td></td></tr>
<tr><td>Password</td><td><input type="password" name="password"></td><td></td></tr>
<tr><td>Confirm Password</td><td><input type="password" name="cpassword"></td><td></td></tr>
<tr><td>Qulification</td><td>
<input type="checkbox"
name="qulification[]"
value="High
School">High School
<input type="checkbox"
name="qulification[]"
value="Intermidiate">Intermidiate
<input type="checkbox"
name="qulification[]"
value="Graduation">Graduation
<input type="checkbox"
name="qulification[]"
value="Post
Graduation">Post Graduation
</td><td></td></tr>
<tr><td>Current City</td><td><select name="city" id="" width="500px">
<option value="">Select</option>
<option value="Delhi">Delhi</option>
<option value="Noida">Noida</option>
<option value="Varanasi">Varanasi</option>
<option value="Ghaziabd">Ghaziabad</option>
</select></td><td></td></tr>
<tr><td><input type="submit"
name="sub"></td><td></td><td></td></tr>
</table>
</form>
</body>
</html>
Subscribe to:
Posts (Atom)