I have method SwitchScreen to change userControl. I want change my app from C# to VB. I tried to find on google but no result. Can someone help? :(
here is my method:
public void SwitchScreen(object sender, string getText)
{
var screen = (UserControl)sender;
headerTitle.Text = getText;
if ((screen) != null)
{
StackPanelMain.Children.Clear();
StackPanelMain.Children.Add(screen);
}
}
i've tried like this in VB:
Public Sub SwitchScreen(sender As Object, getText As String)
Dim Screen = sender(UserControl)
headerTitle.Text = getText
If (Screen Is Nothing) Then
StackPanelMain.Children.Clear()
StackPanelMain.Children.Add(Screen)
End If
End Sub
But error on Dim Screen = sender(UserControl), 'UserControl' is a class type and cannot be used as an expression.