2015-09-01 30 views
0
private void LoginButton_Click(object sender, RoutedEventArgs e) 
{ 
    if(username.Text == "")   
      MessageBox.Show("Enter username"); 
    else if (password.Password == "")    
      MessageBox.Show("Enter password"); 
    else if (username.Text == "anve" && password.Password == "123") 
    { 
      MessageBox.Show("Success !"); 
      Frame.Navigate(typeof(List)); 
    } 
    else 
      MessageBox.Show("Enter Valid Credentials");    
} 

我正在爲我的應用程序創建一個登錄頁面。我添加了System.Windows.Forms引用並使用了MessageBox.Show。但它給出了一個錯誤「無法在模塊mscorlib.dll中找到類型System.Resources.ResourceSet」。'在windows phone 8.1的模塊mscorlib.dll'中找不到類型System.Resources.ResourceSet應用程序

回答

3

您不能在Windows Phone 8.1項目中使用Windows.Forms命名空間。

使用MessageDialog代替

private async void ShowMessageDialog() 
{ 
    MessageDialog msgbox = new MessageDialog("Hello!"); 
    await msgbox.ShowAsync(); 
} 

或較短的版本

await new MessageDialog("Hello!").ShowAsync(); 
相關問題