Sunday 15 June 2014

wpf - DesignTime only error when trying to load an xml to a dataset -


I have created a simple WPFApplication project that produces this error

This is the correct error:

/ P>

file 'C: \ Users \ Andrei \ AppData \ Local \ Microsoft \ VisualStudio \ 11.0 \ Designer \ ShadowCache \ dj2szrx3.5nm \ e412xqna.uj1 \ Locality.xml' Could not find E: \ BugDemo2 \ BugDemo2 \ MainWindow.xaml 7 9 BugDemo2

Main window. Xml

  & lt; Window xmlns = "http://schemas.microsoft.com/windfx/ 2006/xaml/production" xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml" xmlns: local = "clr- Namespace: wpfApplication1 "xmlns: d =" http: //schemas.microsoft.com/expression/blend/2008 "xmlns: mc =" http://schemas.openxmlformats.org/markup-compatibility/2006 "mc: Ignorable = "D" x: class = "main window" heading = "main window" height = "350" width = "525" & gt; & Lt; Window.Resources & gt; & Lt ;! - This is the line that Visual Studio says is an error - & gt; & Lt; Local: Menwindow View Model X: Key = "Main Windmodd Datasource" D: IS DataSource = "True" /> & Lt; /Window.Resources> & Lt; Grid Datacentext = "{Binding Source = {Static Resources Manwando Vivamodel Datasource}}" /> & Lt; / Window & gt;   

MainWindowViewModel.vb

  Import System. Data import system IO Public Square Main WindowViewModel Shared DS New Dataset ("Locality") Public Sub New () MySub () End Sub Subsy MySub () 'This is the line that actually returns error. ReedxL (path.get directory name (system. Reflection.exabacations.get excerpting attacks) and "locality.exml")   at the end of the MSBBC (DS.Tables.Count) and End Class. 

I have a Main Window.xml VB

  Class Main-Window and Class   

This program does exactly what it should, it should Locality.xml loads the dataset correctly and shows how many tables are there if I transfer the DS variable to another module, or in another class, I get it as a shared asset

  object references to an object Do not set the example of T   

Even as a design time error.

I understand that Visual Studio does not know that Locality.xml, but why it cares and how do I remove this error?

Use security code, and more debuggable because you execute readxml You can check the variable before:

  Sub MySub () String = path as a slow path.Get directory name (system .phollection.execxeter.get excping.php assembly location.) ; "Locality.xml" If IO.File.Exists (path) then ds.ReadXml (path) MsgBox (ds.Tables.Count) expires if sub    

No comments:

Post a Comment