Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Navigation Paths never works : System.ArgumentException
Message
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00906986
Message ID:
00907053
Views:
14
Hi Kevin,

Here is the main thing, I removed a few stuff to make it lighter (like InitializeComponent method) but all the necessary code is here. As you can see I'm doing almost the exact same thing as in the help file. This works with the oDS.Tables("work") kind of binding at the end, but what would I do if I had a relation ? I even tried to build the tables and data myself instead of loading the XML file to make sure it wasn't the way the XML was loaded.

Thanks for your help.
Public Class Form1
    Inherits System.Windows.Forms.Form
    Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
    Private oDS As DataSet
    Private oWorkBC As BindingManagerBase

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()
        LoadData()
        BindData()

        'Add any initialization after the InitializeComponent() call

    End Sub

    Private Sub LoadData()
 
         oDS = New DataSet

        'Load data into DataSet
        Dim FsXML1 As New FileStream("Work.xml"), FileMode.Open, FileAccess.Read)
        Dim FsXSD1 As New FileStream("Work.xsd"), FileMode.Open, FileAccess.Read)
        'Load the schema into the DataSet
        Dim xtrXSD1 As New XmlTextReader(FsXSD1)
        oDS.ReadXmlSchema(xtrXSD1)
        xtrXSD1.Close()
        FsXSD1.Close()
        'Load the data into the DataSet
        Dim xtrXML1 As New XmlTextReader(FsXML1)
        oDS.ReadXml(xtrXML1)
        xtrXML1.Close()
        FsXML1.Close()
    End Sub

    Private Sub BindData()
        'Me.LblTask_Desc.DataBindings.Add(New Binding("Text", oDS, "work.task_desc")) 'CRASH
        Me.LblTask_Desc.DataBindings.Add(New Binding("Text", oDS.Tables("work"), "task_desc"))

        'Me.TxtComments.DataBindings.Add(New Binding("Text", oDS, "work.comments"))  'CRASH
        Me.TxtComments.DataBindings.Add(New Binding("Text", oDS.Tables("work"), "comments"))

        'Me.oWorkBC = Me.BindingContext(oDS,"work"))  'CRASH
        Me.oWorkBC = Me.BindingContext(oDS.Tables("work"))
    End Sub
END Class</Public Class Form1
    Inherits System.Windows.Forms.Form
    Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
    Private oDS As DataSet
    Private oWorkBC As BindingManagerBase

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()
        LoadData()
        BindData()

        'Add any initialization after the InitializeComponent() call

    End Sub

    Private Sub LoadData()
 
         oDS = New DataSet

        'Load data into DataSet
        Dim FsXML1 As New FileStream("Work.xml"), FileMode.Open, FileAccess.Read)
        Dim FsXSD1 As New FileStream("Work.xsd"), FileMode.Open, FileAccess.Read)
        'Load the schema into the DataSet
        Dim xtrXSD1 As New XmlTextReader(FsXSD1)
        oDS.ReadXmlSchema(xtrXSD1)
        xtrXSD1.Close()
        FsXSD1.Close()
        'Load the data into the DataSet
        Dim xtrXML1 As New XmlTextReader(FsXML1)
        oDS.ReadXml(xtrXML1)
        xtrXML1.Close()
        FsXML1.Close()
    End Sub

    Private Sub BindData()
        'Me.LblTask_Desc.DataBindings.Add(New Binding("Text", oDS, "work.task_desc")) 'CRASH
        Me.LblTask_Desc.DataBindings.Add(New Binding("Text", oDS.Tables("work"), "task_desc"))

        'Me.TxtComments.DataBindings.Add(New Binding("Text", oDS, "work.comments"))  'CRASH
        Me.TxtComments.DataBindings.Add(New Binding("Text", oDS.Tables("work"), "comments"))

        'Me.oWorkBC = Me.BindingContext(oDS,"work"))  'CRASH
        Me.oWorkBC = Me.BindingContext(oDS.Tables("work"))
    End Sub
END Class
>Sylvain,
>
>I know the code sample from the help file that you're talking about, because I'm looking at it right now.
>
>Can you post all of the equivalent code of yours?
>
>Thanks,
>Kevin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform