需要c#的等效代码 [英] need equivalent code for c#

查看:78
本文介绍了需要c#的等效代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好。



我对DataGridViewComboBoxColumn有问题。我得到了解决方案,但代码是在VB中。我试图将其转换为c#但仍未找到确切的语法。

代码为: -

 如果  TypeOf  e.Control   ComboBox 然后 
Dim cbo 作为 ComboBox = DirectCast (e.Control,ComboBox)
cbo.DropDownHeight = 250
结束 如果





旺旺把它转换成c#。



需要建议

最好的问候

解决方案

试试这个: -



  if (e.Control   ComboBox){
ComboBox cbo =(ComboBox)e.Control;
cbo.DropDownHeight = 250 ;
}


尝试该片段:

 ComboBox cbo = e.Control  as  ComboBox; 
if (cbo!= null
{
cbo。 DropDownHeight = 250 ;
}


试试这个:

  if (e.Control   ComboBox)
(ComboBox)e.Control.DropDownHeight = 250


Hello There

I have a problem with DataGridViewComboBoxColumn. I got the solution for it but the code is in VB. I tried to convert it into c# but still not find exact syntax.
Code is:-

If TypeOf e.Control Is ComboBox Then
Dim cbo As ComboBox = DirectCast(e.Control, ComboBox)
cbo.DropDownHeight = 250
End If



Want to convert it into c#.

Need Suggestion
Best Regards

解决方案

try this:-

if (e.Control is ComboBox) {
    ComboBox cbo = (ComboBox)e.Control;
    cbo.DropDownHeight = 250;
}


Try that snippet:

ComboBox cbo = e.Control as ComboBox;
if(cbo != null)
{
    cbo.DropDownHeight = 250;
}


Try this:

if (e.Control is ComboBox)
    (ComboBox)e.Control.DropDownHeight = 250;


这篇关于需要c#的等效代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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