c#代码转为vb.net代码问题
这是c#代码:privatevoidInput_Click(objectsender,RoutedEventArgse){varinput=newInputPrompt{...
这是c#代码:
private void Input_Click(object sender, RoutedEventArgs e)
{
var input = new InputPrompt
{
Title = "Basic Input",
Message = "I'm a basic input prompt",
};
input.Completed += input_Completed;
input.Show();
}
void input_Completed(object sender, PopUpEventArgs<string, PopUpResult> e)
{
if (e.PopUpResult == PopUpResult.Ok)
MessageBox.Show("You typed: " + e.Result);
else if (e.PopUpResult == PopUpResult.Cancelled)
MessageBox.Show("CANCELLED! " + e.Result);
else
MessageBox.Show("meh? " + e.Result);
}
转换成相应的vb.net代码:
Private Sub Input_Click(sender As Object, e As RoutedEventArgs)
Dim input As New InputPrompt()
Dim c
input.Completed += input_Completed //这里就出错了
input.Show()
End Sub
Sub input_Completed(sender As Object, e As PopUpEventArgs(Of String, PopUpResult))
If e.PopUpResult = PopUpResult.Ok Then
MessageBox.Show("You typed: " + e.Result)
ElseIf e.PopUpResult = PopUpResult.Cancelled Then
MessageBox.Show("CANCELLED! " + e.Result)
Else
MessageBox.Show("meh? " + e.Result)
End If
End Sub
到 input.Completed += input_Completed这里不知道怎么转,显示出错
请问应该如何改写这条语句呢? 展开
private void Input_Click(object sender, RoutedEventArgs e)
{
var input = new InputPrompt
{
Title = "Basic Input",
Message = "I'm a basic input prompt",
};
input.Completed += input_Completed;
input.Show();
}
void input_Completed(object sender, PopUpEventArgs<string, PopUpResult> e)
{
if (e.PopUpResult == PopUpResult.Ok)
MessageBox.Show("You typed: " + e.Result);
else if (e.PopUpResult == PopUpResult.Cancelled)
MessageBox.Show("CANCELLED! " + e.Result);
else
MessageBox.Show("meh? " + e.Result);
}
转换成相应的vb.net代码:
Private Sub Input_Click(sender As Object, e As RoutedEventArgs)
Dim input As New InputPrompt()
Dim c
input.Completed += input_Completed //这里就出错了
input.Show()
End Sub
Sub input_Completed(sender As Object, e As PopUpEventArgs(Of String, PopUpResult))
If e.PopUpResult = PopUpResult.Ok Then
MessageBox.Show("You typed: " + e.Result)
ElseIf e.PopUpResult = PopUpResult.Cancelled Then
MessageBox.Show("CANCELLED! " + e.Result)
Else
MessageBox.Show("meh? " + e.Result)
End If
End Sub
到 input.Completed += input_Completed这里不知道怎么转,显示出错
请问应该如何改写这条语句呢? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询