列表里面都有的啊,点击编辑你取当前选中行里面的姓名、年龄等赋值给弹出窗体呗比如弹出窗体Form1
在窗体里面定义公共属性,比如 public string Name{get;set;}在弹出窗体前,给属性赋值
Form1 f=new Form1();
f.Name="选中行里面的姓名";
f.ShowDialog();

解决方案 »

  1.   

    编辑信息那个窗体为fromEdit    重写这个构造函数让它带参数
    public  fromEdit(string name ,string age,string class) 
    {
    InitializeComponent();
    this.StartPosition = FormStartPosition.CenterScreen;
    //这里显示信息
    }
    然后在点击edit 那边弹出窗体的时候 这样
    fromEdit  f1 = new fromEdit (name ,age,class)//这里传递信息
    fi.ShowDialog()
      

  2.   

    那如果要子窗体要调用主窗体的刷新datagridview的函数,该怎么弄呢
      

  3.   

    将你绑定时的数据对象传过去,比如
    var data = dataSource[dgv.CurrentCell.RowIndex];
    var frm = new Frm(data);
      

  4.   

    那如果要子窗体要调用主窗体的刷新datagridview的函数,该怎么弄呢
    思路有问题!
    子窗体关闭前,把子窗体修改的东西复制给属性,回到主窗体取这些属性传给你的更新函数
    何必在子窗体再调用主窗体的函数呢?
      

  5.   

    点击dataGridView的哪一行就获取哪一行的数据就OK啦!!
      

  6.   

    你可以将dataGridView设成全局的,这样就可以在其他窗口操作这个dataGridView了
      

  7.   

    C#(winform)中TextBox中显示已选择的即将要修改的信息示例
    //TextBox设置
    <asp:TextBox ID="txtName" runat="server" BackColor="White" Width="115px"></asp:TextBox>//姓名设置
    <asp:TextBox ID="txtAge" runat="server" BackColor="White" Width="115px"></asp:TextBox>//年龄
    <asp:TextBox ID="txtClas" runat="server" BackColor="White" Width="115px"></asp:TextBox>//班级
    <asp:Button ID="btnUpdate" runat="server" Font-Size="9pt" Text="修改" OnClick="btnUpdate_Click" />//修改按钮
    //加载数据库数据显示
    protected void Page_Load(object sender, EventArgs e)
        {        if (!IsPostBack)
            {
                try
                {
                    SqlConnection mycon = new SqlConnection(ConfigurationManager.AppSettings["conn"]);
                    mycon.Open();
                    DataSet mydataset = new DataSet();
                    SqlDataAdapter mydataadapter = new SqlDataAdapter("select * from tb_zhuche where id=" + Request["id"], mycon);
                    mydataadapter.Fill(mydataset, "tb_zhuche");
                    DataRowView rowview = mydataset.Tables["tb_zhuche"].DefaultView[0];
                    this.txtName.Text = Convert.ToString(rowview["tb_userName"]);
                    this.txtAge.Text = Convert.ToString(rowview["tb_userAge"]);
                    this.txtClas.Text = Convert.ToString(rowview["tb_userClas"]);
                    mycon.Close();
                }//codego.net/tags/11/1/
                catch (Exception ex)
                {
                    Response.Write(ex.Message);
                }
            }
        }
    //修改数据信息
    protected void btnUpdate_Click(object sender, EventArgs e)
    {

    try
    {
    SqlData da = new SqlData();
    string P_str_Com = "update tb_zhuche set tb_userName='" + this.txtName.Text + "',tb_userAge='" + this.txtAge.Text + "',tb_userClas='" + this.txtClas.Text + "'"
                + " where ID='" + Request["ID"] + "'";

    bool add = da.ExceSQL(P_str_Com);
    if (add == true)
    {
    Response.Write("<script language=javascript>alert('修改信息成功!');location='AdminManage.aspx'</script>");
    }
    else
    {
    Response.Write("<script language=javascript>alert('修改信息失败!');location='javascript:history.go(-1)'</script>");
    }
    }
    catch (Exception ex)
    {
    Response.Write(ex.Message);
    }
    }
      

  8.   

    主窗体打开子窗体的时候使用ChildForm cf = new ChildForm();
    cf.Owner = this;
    cf.ShowDialog();子窗体获取的时候MainForm mf = (MainForm)this.Owner;
    TextBox1.Text = mf.DataGridView.CurrentRow.Cells["列名"].Value.ToString();