简体   繁体   English

在一个脚本中处理多个DataGridViews?

[英]Handle Multiple DataGridViews In one Script?

I have multiple datagridviews (DGVs) nestled in a tab control. 我有多个datagridviews(DGVs)坐落在选项卡控件中。 I was trying to find a way to handle all the actions where I want to take identical steps in the same location. 我试图找到一种方法来处理我想在同一位置采取相同步骤的所有操作。 For example: 例如:

Sub DGV_UniversalAddRow Handles AnyDataGridView.UserAddedRow

'vs'

Sub DGV1_AddRow Handles DGV1.UserAddedRow

I've figured out that you can make lists and arrays of all the DGVs you have in a project, but I can't figure out how to access the user actions from these? 我已经发现你可以制作项目中所有DGV的列表和数组,但我无法弄清楚如何从这些中获取用户操作? Any hints, terms, or MS articles where this is addressed would be wonderful. 任何有关此问题的提示,条款或MS文章都会很精彩。 I'd be happy to have the answer in C# instead if that helps. 我很乐意在C#中得到答案,如果有帮助的话。

Thanks! 谢谢!

You can handle multiple events with one handles argument. 您可以使用一个handle参数处理多个事件。 IE, IE浏览器,

Sub DGV_UniversalAddRow Handles DataGridView1.UserAddedRow, DataGridView2.UserAddedRow, DataGridView3.UserAddedRow

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM