我如何从另一个表单替换gridview选择? [英] how do i alternate gridview selection from another form?

查看:156
本文介绍了我如何从另一个表单替换gridview选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我想问我们如何使用文本框和按钮

hello i want to ask how do we alternate selection row grid view at main form from another form just using text box and button

从另一个表单的主窗体中替换选择行网格视图图片和代码是以形式1

the picture and code is in form 1

和表单2只允许说只有文本框和按钮
我们如何声明或者使用格式2中格式1的gridview数据?

and form 2 lets say only got text box and button how do we can declare or use gridview data from form 1 in form 2 ?

推荐答案

您可以更改Form2,以便您可以在构造函数中接收gridView:

You could change Form2 so you can receive the gridView in the constructor :

public class Form2 : XtraForm
{
    private GridView grid;

    public Form2(GridView grid)
    {
        this.grid = grid;
    }

    private void somebutton_Click(object sender, EventArgs e)
    {
        grid.FocusedRowHandle = ...
    }
}

所以当您从Form1打开Form2时,只需将gridView发送到Form2构造函数:

So when you open Form2 from Form1, you just send the gridView to the Form2 constructor :

someButtonOnForm1_Click(...)
{
    var form = new Form2(gridView1);
    form.Show(this);
}

这篇关于我如何从另一个表单替换gridview选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆