I work in Asp.net 2008 windowsFormapplication
I have two forms namely edit user and user wizard. At first time i want to select the user name from user wizard form so i add a button on the form. when I click the button the user wizard form display then i select the user name in there and return that value into the edit user .But there was a problem occurred ,2 edit user forms are
show. but i want the first time form only
Here i specifies my codes Please check it and give correct code
1 this code in user wizard
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.SqlClient;
namespace Zealian
{
public partial class Client_Wizard : Form
{
string name;
public string CLName
{
get
{
return name ;
}
}
SqlConnection con = new SqlConnection("server=.;database=zealian;uid=sa;pwd=sqladmin");
public Client_Wizard()
{
InitializeComponent();
}
private void Client_Wizard_Load(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
label3.Visible = false;
SqlDataAdapter da = new SqlDataAdapter("select * from addclient where Client_Name LIKE '" + textBox1.Text + "%' OR ClientId LIKE '" + textBox1.Text + "%'", con);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
}
private void button1_Click(object sender, EventArgs e)
{
Project_Details pd = new Project_Details();
pd.Clientname = CLName;
pd.Show();
this.Close();
}
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
SqlDataAdapter da = new SqlDataAdapter("select Client_Name from addclient where ClientId='" + dataGridView1.CurrentRow.Cells[0].Value.ToString() + "'", con);
DataSet ds = new DataSet();
da.Fill(ds);
name = ds.Tables[0].Rows[0]["Client_Name"].ToString();
}
private void button3_Click(object sender, EventArgs e)
{
ViewClient vc = new ViewClient();
vc.Clientname = CLName;
vc.Show();
this.Close();
}
private void button2_Click(object sender, EventArgs e)
{
Edit_Client ec = new Edit_Client();
ec.Clientname = CLName;
ec.Show();
this.Close();
}
}
}
2. this code in edit user
public partial class Edit_Client : Form
{
public string Clientname
{
set
{
textBox8.Text = value;
}
}
string id;
SqlConnection con = new SqlConnection("server=.;database=zealian;uid=sa;pwd=sqladmin");
public Edit_Client()
{
InitializeComponent();
}