如何在Windows窗体中动态添加三个或更多(n)DataGridView(编程方式) [英] how I can add three or more (n) DataGridView in my Windows Form dinamically (programming way)

查看:113
本文介绍了如何在Windows窗体中动态添加三个或更多(n)DataGridView(编程方式)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

我处于以下情况:

我想在表单中添加"n"个Datagridviews,其中n> 0可能是n = 1,2,...等.

我如何以编程方式做到这一点,也许是在 For cicle
内部
我的数据库中有各种类型的数据,我想将它们放入
Datagridviews的不同之处,这就是我需要您帮助的原因.
预先感谢,

Leonardo Ayala R.

Hello Friends,

I am in following case:

I want to add ''n'' Datagridviews in my form, where n>0 maybe n=1,2,...etc.

How I can do that programatically, maybe inside in a For cicle

I have various types of data in my db and I want to put them in
differents Datagridviews, that is the reason that i need your help.

Thanks in advance,

Leonardo Ayala R.

推荐答案

没有那么困难

Not that difficult

foreach(int x = 0; x < n; x++)
{
   DataGridView dv = new DataGridView();
   dv.DataSource = ...
   Controls.Add(dv);
}


这篇关于如何在Windows窗体中动态添加三个或更多(n)DataGridView(编程方式)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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