简体   繁体   English

尝试在VB中捕获C#

[英]try catch in VB to C#

I want to convert this line from VB to C#: 我想将此行从VB转换为C#:

Catch ex As Exception
        DevComponents.DotNetBar.MessageBoxEx.Show("Đường dẫn không chính xác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information)

I used total this line in C#, but I got error at the name "Devcomponent" Who helps me.. 我在C#中使用了这一行,但是在“ Devcomponent”这个名字帮助我的地方出现了错误。

try
{
    //do whatever
}
catch (Exception ex)
{
    //do whatever
}

If you don't need DevComponents you can use MessageBox.Show() instead 如果不需要DevComponents ,则可以使用MessageBox.Show()代替

catch(Exception ex)
{
  DevComponents.DotNetBar.MessageBoxEx.Show("Đường dẫn không chính xác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information)
}

NOTE: 注意:

but I got error at the name "Devcomponent" 但我在名称“ Devcomponent”时遇到错误

I'm assuming you have imported the .dll for DevComponents and have it in a using statement in your file already, yes? 我假设您已经为DevComponents导入了.dll,并且已经在文件中的using语句中添加了它,是吗? Also, I don't know anything about that specific method, so I can't advise there... 而且,我对该特定方法一无所知,因此我无法在其中提供建议...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM