Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
C#
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;
}
Posted
Updated 27-Mar-12 18:29pm
v2

1 solution

VB
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


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.
 
Share this answer
 
v2
Comments
Luiey Ichigo 28-Mar-12 0:38am    
I already visit the site before but I can't use this code in VB.NET

objModal.Owner = Me

the .Owner is not show in the suggestion after "objModal."
JF2015 28-Mar-12 1:08am    
See my improved answer - it is not enough to convert this snippet - you need to convert the whole project to VB.NET.
Luiey Ichigo 28-Mar-12 2:04am    
Okay..thank you for your support. I appreciate that :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900