如何根据条件选择Datagridview列? [英] how to chnage the Datagridview columns based on the condition?

查看:94
本文介绍了如何根据条件选择Datagridview列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Experts,



我正在使用Windows窗体。如果txtValue =A,那么我想用不同的列标题绑定数据源。如果txtValue =B,那么我想用不同的列标题绑定数据源。如何在Windows Forms for Datagridview中实现这一点?

Hello Experts,

I am working with a windows Forms. If txtValue="A" then I want to bind the Data source with different column headers. If txtValue="B" then I want to bind the data source with different column headers. How to achieve this in windows Forms for Datagridview?

推荐答案

你可以根据条件更改列名

you can change the column name based on condition
If txtValue="A" then
  Datagridview1.Columns(0).Name = "Column1(A)"
endif txtValue="B" then
  Datagridview1.Columns(0).Name = "Column1(B)"
end if


这篇关于如何根据条件选择Datagridview列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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