返回首页

我工作在ASP.NET 2008 windowsFormapplication
我有两种形式,即编辑用户和用户向导。在第一时间,我要选择从用户向导形式的用户名,所以我在窗体上添加一个按钮。当我按一下按钮,用户向导的形式显示,然后我选择在那里的用户名,并返回该值进入编辑用户,但是有一个问题发生,2编辑用户形式是
显示。但我想在第一时间形式只有

在这里,我指定我的代码,请检查并给予正确的代码

1此代码在用户向导

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。此代码在编辑用户
{C}

回答

评论会员:y 时间:2