Datagridview完全隐藏了第二次绑定源 [英] Datagridview is completely hidden for bindingsource the second time

查看:77
本文介绍了Datagridview完全隐藏了第二次绑定源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

private void populateListingGrid(){

try{

Dictionary<string, Object> responseMap = new Dictionary<string, object>();                
PaginationList newContractDetailsListingMsDTO = getNewContractDetailsListingMsDTO();                
ContractService createContractService = ContractServiceFactory.getInstance();
responseMap = createContractService.getContractListing();                
contractList = responseMap["contractListingMsDTOs"] as List<NewContractListingMsDTO>;
this.newContractListingMsDTOBindingSource.Clear();
             if (contractList != null && contractList.Count > 0)
             {
                 newContractListingMsDTOBindingSource.DataSource = contractList;
                 newContractListDataGridView.Refresh();
             }
}
catch (Exception e)
{
   logger.Info("populateListingGrid");
}
}

我正在使用 newContractListingMsDTOBindingSource 作为绑定源,当我第一次打开datagrid时,它工作得非常好,当我尝试在winforms中重新打开datagridview时,整个datagridview似乎崩溃了,甚至连绑定源的列标题都看不到。

I am using the newContractListingMsDTOBindingSource as a bindingsource, which works perfectly fine when i open the datagrid for first time, when i try to reopen the datagridview in winforms, entire datagridview seems crashed nothing is visible not even the column header of the bindingsource.

我正确使用了所有绑定源或绑定数据源代码吗?

Am i using all the binding source or binding data source code correctly?

推荐答案

经过反复试验,我找到了解决问题的方法,当我设置以下属性时DataGridView

After a lot of trial and error, i found the solution to the problem, it worked when i set the below property of the DataGridView


ColoumnHeadersHieghtSizeMode => AutoSize

ColoumnHeadersHieghtSizeMode => AutoSize

如果我将此属性更改为DisableResizing / EnableResizing,则Datagridview将第二次隐藏。探针不是直接与BindingSource或Datasource一起使用。

If i change this property to DisableResizing/EnableResizing the Datagridview gets hidden the 2nd time. The probelem is not with the BindingSource or Datasource directly.

这篇关于Datagridview完全隐藏了第二次绑定源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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