小编Mog*_*gli的帖子

如何在不使用 e.Cancel 方法的情况下取消事件?

我想取消数据gridview单元格单击事件

private void gridViewHistory_CellClick(object sender, DataGridViewCellEventArgs e)
{      
}
Run Code Online (Sandbox Code Playgroud)

但是这个eventargs没有取消事件,如何取消该事件?也许这个问题有一个非常简单的答案,但我仍然陷入困境,需要帮助。

提前致谢。

c# event-handling winforms

2
推荐指数
1
解决办法
5252
查看次数

什么是不一致的可访问性错误?

我正在使用自定义角色提供程序,因为我创建了一个CustomRoleProvider类并RoleProvider在其中实现了一些方法,就像这样

 public class CustomRoleProvider: RoleProvider
 {
 public override void CreateRole(string roleName)
    {
        throw new NotImplementedException();
    }

    public override bool DeleteRole(string roleName, bool throwOnPopulatedRole)
    {
        throw new NotImplementedException();
    }
  }
Run Code Online (Sandbox Code Playgroud)

所有方法都是公开的.但它显示错误

错误4 - 不一致的可访问性:基类'RoleProviderExample.RoleProvider'比类'RoleProviderExample.CustomRoleProvider'更难访问.

我在哪里做错了?

c# asp.net interface class

1
推荐指数
1
解决办法
1221
查看次数

如何在DataTable上检查IS NULL?

在我的情况下,我传递一个SQL查询并获取数据集中的数据,但当我尝试获取ParentId列包含NULL的行时出现问题.这是一段代码.

   DataSet ds = GetDataSet("Select ProductId,ProductName,ParentId from ProductTable");

   //ds is not blank and it has 2 rows in which ParentId is NULL

   DataRow[] Rows = ds.Tables[0].Select("ParentId IS NULL");
Run Code Online (Sandbox Code Playgroud)

但我仍然没有得到任何行.需要帮忙.感谢名单.

c# linq asp.net datatable

1
推荐指数
2
解决办法
3万
查看次数

在.net framework 2.0中使用Linq?

我在.net framework 4.0,visual studio 2010中创建了一个应用程序,但由于某些原因我将框架从4.0更改为2.0但现在我收到错误

The type or namespace name 'Linq' does not exist in the namespace 'System' (are you 
missing an assembly reference?) 
Run Code Online (Sandbox Code Playgroud)

LINQ在这个项目中非常常用,现在我想知道有没有办法使用LINQ和.net 2.0.Need help.Thanks.

c# linq visual-studio-2010 winforms

1
推荐指数
2
解决办法
1万
查看次数

'void'和'<null>'之间的隐式转换?

我想在这里做一件非常简单的事 -

我需要在表格布局面板中找到一个控件

1)如果控件存在 - 删除控件

2)否则我不需要做任何事情

除了if\else之外,我决定使用条件运算符.我的代码是:

var temp=(tableLayoutExamPanel.Controls.Find("lbl3", true)[0].Name==("lbl3")) ? (tableLayoutExamPanel.Controls.Find("lbl3", true)[0].Dispose()) : null ;
Run Code Online (Sandbox Code Playgroud)

但我面临这个错误:

Type of conditional expression cannot be determined because there is no implicit conversion between 'void' and '<null>' 
Run Code Online (Sandbox Code Playgroud)

谷歌有这么多的解决方案,但没有一个适合我,我没有找到任何无效的解决方案,陷入其中,需要帮助.

提前致谢.

c# conditional-operator winforms

0
推荐指数
1
解决办法
873
查看次数