首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

用vb编写wpf窗口程序,为什么运行的时候老师弹出这个异常窗口啊

2012-01-05 
用vb编写wpf窗口程序,为什么运行的时候老师弹出这个错误窗口啊?程序编写完后,老师弹出一个感叹号窗口,信息

用vb编写wpf窗口程序,为什么运行的时候老师弹出这个错误窗口啊?
程序编写完后,老师弹出一个感叹号窗口,信息如下:
  未处理的“System.IO.IOException”类型的异常出现在 PresentationFramework.dll 中。

  其他信息: 找不到资源“window1.xaml”。
代码我是照着书上敲的。连续几个小题目都是这个样子, 把我郁闷惨了,有谁知道如何解决吗?小弟菜鸟,才入门,不知道怎么办,急死我了。谢谢了。
另外我弄不上来截图,只有把代码拷贝上来了:
//TextEditor.xaml
<Window x:Class="Window1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="Text Editor" Height="460" Width="600">
  <Grid>
  <ToolBarPanel Height="26" Name="ToolBarPanel1" VerticalAlignment="Top">
  <ToolBar Height="26" Name="ToolBar1" Width="575">
  <Button Name="tbrClear" ToolTip="Clear">
  <Image Source="file:///E:/Program Files/Microsoft Visual Studio 9.0/Common7/VS2008ImageLibrary/2052/VS2008ImageLibrary/VS2008ImageLibrary/Actions/32bitcolor bitmaps/16x16/NewDocumentHS.BMP"></Image>
  </Button>
  <Separator />
  <Button Name="tbrRed" ToolTip="Red">
  <Image Source="file:///E:/Program Files/Microsoft Visual Studio 9.0/Common7/VS2008ImageLibrary/2052/VS2008ImageLibrary/VS2008ImageLibrary/Actions/32bitcolor bitmaps/16x16/Color_fontHS.bmp"></Image>
  </Button>
  <Button Name="tbrBlue" ToolTip="Blue">
  <Image Source="file:///E:/Program Files/Microsoft Visual Studio 9.0/Common7/VS2008ImageLibrary/2052/VS2008ImageLibrary/VS2008ImageLibrary/Actions/32bitcolor bitmaps/16x16/Color_lineHS.bmp"></Image>
  </Button>
  <Separator/>
  <Button Name="tbrUpperCase" ToolTip="Upper Case">
  <Image Source="file:///E:/Program Files/Microsoft Visual Studio 9.0/Common7/VS2008ImageLibrary/2052/VS2008ImageLibrary/VS2008ImageLibrary/Actions/32bitcolor bitmaps/16x16/FillUpHS.BMP"></Image>
  </Button>
  <Button Name="tbrLowerCase" ToolTip="Lower Case">
  <Image Source="file:///E:/Program Files/Microsoft Visual Studio 9.0/Common7/VS2008ImageLibrary/2052/VS2008ImageLibrary/VS2008ImageLibrary/Actions/32bitcolor bitmaps/16x16/FillDownHS.BMP"></Image>
  </Button>
  <Separator/>
  <Button Name="tbrHelpAbout" ToolTip="About">
  <Image Source="file:///E:/Program Files/Microsoft Visual Studio 9.0/Common7/VS2008ImageLibrary/2052/VS2008ImageLibrary/VS2008ImageLibrary/Annotations&amp;Buttons/bmp_format/Help.BMP"></Image>
  </Button>
  </ToolBar>
  <ToolBarTray Height="26" Name="ToolBarTray1" Width="200" />
  </ToolBarPanel>
  <StatusBar Height="23" Name="StatusBar1" VerticalAlignment="Bottom" Margin="0,0,1.5,0">
  <StatusBarItem Name="sbiStatus">Ready</StatusBarItem>
  </StatusBar>
  <TextBox Margin="0,26,0,22" Name="txtEdit" VerticalScrollBarVisibility="Visible" AcceptsReturn="True" TextWrapping="Wrap" />
  </Grid>
</Window>


//Application.xaml
<Application x:Class="Application"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  StartupUri="Window1.xaml">
  <Application.Resources>
   
  </Application.Resources>
</Application>


[解决办法]
你似乎对wpf的整个体系结构还不是很清楚,埋头直接抄例子,可能不是一个好办法。

你的Application.xaml里明明写着,StartupUri="Window1.xaml
为什么主窗口又以TextEditor.xaml命名呢?
[解决办法]

探讨

我按你的方法弄出来了,你说的情况我确实在考虑,埋头直接抄例子。我现在看的这本书是Visual Basic 2008 入门经典,里面的练习很多,基本上是以练带学。你的意思是怎么一个学习方法?是看了书,照着练习一道,然后再仔细揣摩一下代码?目前我的情况是,照着书,我会,但是关上书,就不会了。由于自学,方法肯定有自身的问题,请指教。谢谢你。

[解决办法]
初学的话,还是先理解语法和概念吧,具体的技术还是不要太多的关注,会用就好,或者知道就好
能自己写一段东西出来,能正常运行,不报错,就算很不错了

热点排行