也尝试使项目正确运行

时间:2019-04-12 22:54:39

标签: visual-studio-2017

完成本书中的项目,我正在使用WPF进行第一个操作。相当直截了当;当我要调试程序时,我遇到了一个问题,即程序上缺少一行代码。

[MessageBox.Show(“ Hello” + textSayHello.Text +“!”);]部分在书中,但当我在WPF中设计程序时不在。虽然是用于解释调试的部分。第16页。

  • 这是在书中,但在WPF中创建时不在程序中。我正在尝试编写它,尽管我将其声明为断点,但它指出在按F5键时缺少.exe。
  • 然后指出该项目需要构建,因此我构建了该项目,响应为“名称textSayHello在当前上下文中不存在”。
  • 我尝试创建第1行的.txt文件为“ Hello World!”。那没有用,也许我把它保存错了。
  • I,尽管了解编程的概念是一个新手程序员。

    使用系统; 使用System.Collections.Generic; 使用System.Linq; 使用System.Text; 使用System.Windows; 使用System.Windows.Controls; 使用System.Windows.Data; 使用System.Windows.Documents; 使用System.Windows.Input; 使用System.Windows.Media; 使用System.Windows.Media.Imaging; 使用System.Windows.Navigation; 使用System.Windows.Shapes;

    命名空间WpfApp1 {     ///     /// MainWindow.xaml的交互逻辑     ///     公共局部类MainWindow:Window     {         公共MainWindow()         {              InitializeComponent();         }

        private void btnSayHello_Click(object sender, RoutedEventArgs e)
        {
    
        }
    
        private void txtSayHello_TextChanged(object sender,     TextChangedEventArgs e)
        {
            MessageBox.Show("Hello" + textSayHello.Text + "!");
    
        }
    }
    

    }

预期结果将运行调试。然后如书中所述,“部署您的应用程序”。

0 个答案:

没有答案
相关问题