将代码从C#转换为VB [英] Converting code from c# TO VB

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

问题描述

亲爱的人

我对C#一无所知,但是我从Microsoft获得了用c#编写的datagridviewcustomcolumn示例.我已经使用Web实用程序来转换代码.但是,转换后的代码中有一小部分效果不佳,

因此,如果有人为我将这段代码转换为vb,我将不胜感激.代码如下所示:

Hi folks

I know nothing about c# but I got sample from Microsoft for datagridviewcustomcolumn which is written in c#. I have used web utilities to convert the code. However, a small segment of the converted code did no turn out well,

I should therefore be very grateful if anyone converts this block of code to vb for me. The code is shown below:



//   Quick routine to convert from DataGridViewTriState to boolean.
        //   True goes to true while False and NotSet go to false.
        protected static bool BoolFromTri(DataGridViewTriState tri)
        {
            return (tri == DataGridViewTriState.True) ? true : false;
        }



        //  Routine to convert from boolean to DataGridViewTriState.
        private static DataGridViewTriState TriBool(bool value)
        {
            return value ? DataGridViewTriState.True
                         : DataGridViewTriState.False;
        }

推荐答案

尝试以下链接:

http://www.developerfusion.com/tools/convert/vb-to-csharp /#convert-again [ ^ ]
Try this link:

http://www.developerfusion.com/tools/convert/vb-to-csharp/#convert-again[^]


http://www.developerfusion.com/tools/convert/csharp-to-vb/ [
http://www.developerfusion.com/tools/convert/csharp-to-vb/[^]. Try the above link to convert your C# to VB


您正在代码中使用短路if 语句.
您需要将它们转换为VB等效语法.

这是一个例子
return If(tri = DataGridViewTriState.True, True, False))

您可以自己尝试第二个.
You are using short circuit if statements in your code.
You need to convert them into the VB equivalent syntax.

Here is an example
return If(tri = DataGridViewTriState.True, True, False))

You can try the second one on your own.


这篇关于将代码从C#转换为VB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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