如何在Windows窗体中将DataGrid中的单元格值从一个窗体转移到另一个窗体? [英] How to Retrive cell values from DataGrid to TextBoxes from one Form to other in Windows Forms?

查看:74
本文介绍了如何在Windows窗体中将DataGrid中的单元格值从一个窗体转移到另一个窗体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想将DataGridView单元格值从一个Form传递到另一个。这里DataGridView是使用joins从Data Base绑定的。我的表由10列组成但我想仅绑定5 DGV的列,当我双击DGV中的单元格时,基于Id,我希望获得TextBoxes的所有值(来自DGV的5个单元格值和来自数据库的5个单元格)。我从DGV获得了5个值,但是如何从数据库获得剩余的5个值。

如何解决这个问题?

感谢Advance ..

Hi,
I want to pass DataGridView cell values from one Form to another.Here the DataGridView is binding from Data Base using joins.My Table consists of 10 columns but I want to Bind only 5 columns to the DGV and when I double click on cell in DGV,based on Id I want to get all values to the TextBoxes(5 cell values from DGV and 5 columns from Data Base). I am getting 5 values from DGV but How to get remaining 5 values from Data Base.
How to solve this problem??
Thanks as Advance..

推荐答案

首先,考虑将数据不是从控制传递到控制,而是从数据层传递到控制。



如果您仍然希望将单元格数据从一个表单传递到另一个表单(请参阅我对该问题的评论;我希望您的问题实际上是关于将数据从一个表单传递到另一个表单),请参阅我的文章一次回答多个问题 - Windows窗体或WPF Windows之间的协作 [ ^ ]。



-SA
First of all, consider passing data not from control to control, but from data layer to control.

If you still want to pass cell data from one form to another (please see my comment to the question; I hope your question is actually about passing data from one to another form), please see my article Many Questions Answered at Once — Collaboration between Windows Forms or WPF Windows[^].

—SA


这篇关于如何在Windows窗体中将DataGrid中的单元格值从一个窗体转移到另一个窗体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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