如何使用上下文菜单条将所选行从datagridview显示到另一个表单? [英] How to display selected row from datagridview to another form by using context menu strip?

查看:37
本文介绍了如何使用上下文菜单条将所选行从datagridview显示到另一个表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。



我有一个问题,就是如何通过使用上下文菜单条将数据网格视图中的选定行显示到包含文本框的表单。 br />
我还没有尝试过任何东西,因为这是我第一次遇到这个。我已经在datagridview所在的表单中添加了一个上下文菜单条。我现在正在寻找的是如何将选定的行显示到另一个表单,以便我能够编辑它。提前致谢,。 :)

Hi guys.

I have a problem on how to display the selected row from the datagridview to a form that contains textboxes by using the context menu strip.
I have not yet tried anything since this is the first time that I encountered this. I have already added a context menu strip to my form where datagridview is. What I am looking for now is on how to display the selected row to another form for me to be able to edit it. Thanks in advance,. :)

推荐答案

EditStudentInformation frm = new EditStudentInformation();
            frm.label2.Text = this.dg_studSearch.CurrentRow.Cells[0].Value.ToString();
            frm.textBox2.Text = this.dg_studSearch.CurrentRow.Cells[1].Value.ToString();
            frm.textBox3.Text = this.dg_studSearch.CurrentRow.Cells[2].Value.ToString();
            frm.textBox1.Text = this.dg_studSearch.CurrentRow.Cells[3].Value.ToString();
            frm.textBox5.Text = this.dg_studSearch.CurrentRow.Cells[7].Value.ToString();
            frm.textBox6.Text = this.dg_studSearch.CurrentRow.Cells[8].Value.ToString();
            frm.textBox7.Text = this.dg_studSearch.CurrentRow.Cells[9].Value.ToString();
            frm.label8.Text = this.dg_studSearch.CurrentRow.Cells[4].Value.ToString();
            frm.label13.Text = this.dg_studSearch.CurrentRow.Cells[10].Value.ToString();
            frm.textBox8.Text = this.dg_studSearch.CurrentRow.Cells[11].Value.ToString();
            frm.textBox4.Text = this.dg_studSearch.CurrentRow.Cells[12].Value.ToString();

            frm.ShowDialog();


这篇关于如何使用上下文菜单条将所选行从datagridview显示到另一个表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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