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 Microsoft.VisualBasic;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public int index;
public int ch,temp=0;
public Form1()
{
InitializeComponent();
}
public struct Student
{
public int sno;
public string fname;
public string lname;
public DateTime dob;
}
Student [] arr=new Student[1];
private void btnSave_Click(object sender, EventArgs e)
{
//Student[] arr = new Student[1];
arr[index].sno = Convert.ToInt32(textBox1.Text);
arr[index].fname = textBox2.Text;
arr[index].lname = textBox3.Text;
arr[index].dob = Convert.ToDateTime(textBox4.Text);
index++;
Array.Resize(ref arr,index+1);
textclear();
}
private void textclear()
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
}
private void btnLast_Click(object sender, EventArgs e)
{
// Student[] arr = new Student[1];
textBox1.Text = arr[index-1].sno.ToString();
textBox2.Text = arr[index-1].fname;
textBox3.Text = arr[index-1].lname;
textBox4.Text = arr[index-1].dob.ToShortDateString();
temp = index;
}
private void btnFirst_Click(object sender, EventArgs e)
{
//Student[] arr = new Student[1];
textBox1.Text = arr[0].sno.ToString();
textBox2.Text = arr[0].fname;
textBox3.Text = arr[0].lname;
textBox4.Text = arr[0].dob.ToShortDateString();
temp = 0;
}
private void button5_Click(object sender, EventArgs e)
{
textclear();
}
private void btnCLose_Click(object sender, EventArgs e)
{
Form.ActiveForm.Close();
}
private void btnSearch_Click(object sender, EventArgs e)
{
int i;
//For this right click on project add refrence click on .net and select microsoft visual basic
int sear= Convert.ToInt32(Microsoft.VisualBasic.Interaction.InputBox("Enter The Sno.To Be Searched"));
for(i=0;i<=arr.Length-1;i++)
{
if(arr[i].sno==sear)
{
//break;
textBox1.Text = arr[i].sno.ToString();
textBox2.Text = arr[i].fname;
textBox3.Text = arr[i].lname;
textBox4.Text = arr[i].dob.ToShortDateString();
ch = i;
return;
}
}
MessageBox.Show ("Id Not Found");
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void btnUpdate_Click(object sender, EventArgs e)
{
arr[ch].sno = Convert.ToInt32(textBox1.Text);
arr[ch].fname=textBox2.Text ;
arr[ch].lname=textBox3.Text ;
arr[ch].dob = Convert.ToDateTime(textBox4.Text);
}
private void btnDelete_Click(object sender, EventArgs e)
{
int i;
//For this right click on project add refrence click on .net and select microsoft visual basic
int sear = Convert.ToInt32(Microsoft.VisualBasic.Interaction.InputBox("Enter The Sno.To Be Deleted"));
for (i = 0; i < index; i++)
{
if (arr[i].sno == sear)
{
for (int j = i; j <index; j++)
{
arr[j] = arr[j+1];
index--;
Array.Resize(ref arr, index + 1);
}
}
}
}
private void btnNext_Click(object sender, EventArgs e)
{
if (temp < index-1)
{
temp++;
textBox1.Text = arr[temp].sno.ToString();
textBox2.Text = arr[temp].fname;
textBox3.Text = arr[temp].lname;
textBox4.Text=arr[temp].dob.ToShortDateString();
}
}
private void btnPre_Click(object sender, EventArgs e)
{
if (temp > 0)
{
temp--;
textBox1.Text = arr[temp].sno.ToString();
textBox2.Text = arr[temp].fname;
textBox3.Text = arr[temp].lname;
textBox4.Text = arr[temp].dob.ToShortDateString();
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.VisualBasic;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public int index;
public int ch,temp=0;
public Form1()
{
InitializeComponent();
}
public struct Student
{
public int sno;
public string fname;
public string lname;
public DateTime dob;
}
Student [] arr=new Student[1];
private void btnSave_Click(object sender, EventArgs e)
{
//Student[] arr = new Student[1];
arr[index].sno = Convert.ToInt32(textBox1.Text);
arr[index].fname = textBox2.Text;
arr[index].lname = textBox3.Text;
arr[index].dob = Convert.ToDateTime(textBox4.Text);
index++;
Array.Resize(ref arr,index+1);
textclear();
}
private void textclear()
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
}
private void btnLast_Click(object sender, EventArgs e)
{
// Student[] arr = new Student[1];
textBox1.Text = arr[index-1].sno.ToString();
textBox2.Text = arr[index-1].fname;
textBox3.Text = arr[index-1].lname;
textBox4.Text = arr[index-1].dob.ToShortDateString();
temp = index;
}
private void btnFirst_Click(object sender, EventArgs e)
{
//Student[] arr = new Student[1];
textBox1.Text = arr[0].sno.ToString();
textBox2.Text = arr[0].fname;
textBox3.Text = arr[0].lname;
textBox4.Text = arr[0].dob.ToShortDateString();
temp = 0;
}
private void button5_Click(object sender, EventArgs e)
{
textclear();
}
private void btnCLose_Click(object sender, EventArgs e)
{
Form.ActiveForm.Close();
}
private void btnSearch_Click(object sender, EventArgs e)
{
int i;
//For this right click on project add refrence click on .net and select microsoft visual basic
int sear= Convert.ToInt32(Microsoft.VisualBasic.Interaction.InputBox("Enter The Sno.To Be Searched"));
for(i=0;i<=arr.Length-1;i++)
{
if(arr[i].sno==sear)
{
//break;
textBox1.Text = arr[i].sno.ToString();
textBox2.Text = arr[i].fname;
textBox3.Text = arr[i].lname;
textBox4.Text = arr[i].dob.ToShortDateString();
ch = i;
return;
}
}
MessageBox.Show ("Id Not Found");
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void btnUpdate_Click(object sender, EventArgs e)
{
arr[ch].sno = Convert.ToInt32(textBox1.Text);
arr[ch].fname=textBox2.Text ;
arr[ch].lname=textBox3.Text ;
arr[ch].dob = Convert.ToDateTime(textBox4.Text);
}
private void btnDelete_Click(object sender, EventArgs e)
{
int i;
//For this right click on project add refrence click on .net and select microsoft visual basic
int sear = Convert.ToInt32(Microsoft.VisualBasic.Interaction.InputBox("Enter The Sno.To Be Deleted"));
for (i = 0; i < index; i++)
{
if (arr[i].sno == sear)
{
for (int j = i; j <index; j++)
{
arr[j] = arr[j+1];
index--;
Array.Resize(ref arr, index + 1);
}
}
}
}
private void btnNext_Click(object sender, EventArgs e)
{
if (temp < index-1)
{
temp++;
textBox1.Text = arr[temp].sno.ToString();
textBox2.Text = arr[temp].fname;
textBox3.Text = arr[temp].lname;
textBox4.Text=arr[temp].dob.ToShortDateString();
}
}
private void btnPre_Click(object sender, EventArgs e)
{
if (temp > 0)
{
temp--;
textBox1.Text = arr[temp].sno.ToString();
textBox2.Text = arr[temp].fname;
textBox3.Text = arr[temp].lname;
textBox4.Text = arr[temp].dob.ToShortDateString();
}
}
}
}

No comments:
Post a Comment