我想在一个窗体上放一个DataGridView,另一个窗体上放一写TextBox,我在第一个窗体上选择DataGridView上一行的数据后,第二个窗体上的TextBox显示对于的数据,怎么实现,谢谢了!

解决方案 »

  1.   

    在datagrid中加button列
    <asp:ButtonColumn Text="" CommandName="Select">
    <HeaderStyle Width="20px"></HeaderStyle>
    <ItemStyle HorizontalAlign="Center" ForeColor="Black"></ItemStyle>
    </asp:ButtonColumn>private void dgdGrid_SelectedIndexChanged(object sender, System.EventArgs e)
    {
    this.txtbox.text = this.dgdGrid.Cells[1].Text
    }
      

  2.   

    C/S or B/S
    C/S可以用窗体绑定类来控制,显示的记录
      

  3.   

    从窗体的BindingContext得到一个CurrencyManager,两个控件分别与数据视图绑定,然后设置
    CurrencyManager的Position就可以同步了