将代码从C#转换为VB.NET [英] Converting code from C# to VB.NET
问题描述
大家好,
我这里有一个问题,我有C#的代码,想使用VB.net平台,但是它们之间有一些不同的代码.有人可以帮助我提供有关C#中的代码和VB.NET中的代码的链接.示例为:
C#VB.NET
使用导入[名称空间]
我有一些从互联网上获取的代码.有人可以将其转换为可用于VB.NET吗?请帮帮我.
Hi all,
I have an issue here where I have the code from C# and want to use a VB.net platform but there are some differ code between them. Can someone help me to give a link about the code in C# and code in VB.NET. Example is:
C# VB.NET
using imports [ namespace ]
And I have some code where I get from internet. Can someone convert it to usable for VB.NET?? Please help me.
private void btnShowDialog_Click(object sender, RoutedEventArgs e)
{
WinModalDialog objModal = new WinModalDialog();
objModal.Owner = this;
ApplyEffect(this);
objModal.ShowDialog();
ClearEffect(this);
}
private void ApplyEffect(Window win)
{
System.Windows.Media.Effects.BlurEffect objBlur = new
System.Windows.Media.Effects.BlurEffect();
objBlur.Radius = 4;
win.Effect = objBlur;
}
推荐答案
Private Sub btnShowDialog_Click(sender As Object, e As RoutedEventArgs)
Dim objModal As New WinModalDialog()
objModal.Owner = Me
ApplyEffect(Me)
objModal.ShowDialog()
ClearEffect(Me)
End Sub
Private Sub ApplyEffect(win As Window)
Dim objBlur As New System.Windows.Media.Effects.BlurEffect()
objBlur.Radius = 4
win.Effect = objBlur
End Sub
在此处使用转换工具:
http://www.developerfusion.com/tools/convert/csharp-to-vb/ [^ ]
我想您已经从这里获得了源代码:
^ ]
因此,您将需要将整个项目转换为VB.NET.如果您的智能感知无法识别"WinModalDialog"类,则也需要将其转换为VB.NET.
Using the conversion tool here:
http://www.developerfusion.com/tools/convert/csharp-to-vb/[^]
I guess you have the source code from here:
Make parent window blured for better focus on UI , in WPF[^]
So, you will need to convert the whole project to VB.NET. If your intellisense does not recognize the class "WinModalDialog", you will need to convert that to VB.NET too.
这篇关于将代码从C#转换为VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!