|
-
Apr 15th, 2004, 08:45 AM
#1
Thread Starter
New Member
Declaring A New XML Text Reader
I always get this error when trying to create a xmltextreader:
C:\Documents and Settings\Timothy\My Documents\Visual Studio Projects\Amazon\Form1.vb(65): Overload resolution failed because no accessible 'New' accepts this number of arguments.
Code:
Imports System.Xml
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(56, 40)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(96, 24)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(256, 238)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim tRead As XmlTextReader = New XmlTextReader
End Sub
End Class
-
Apr 15th, 2004, 09:51 AM
#2
Frenzied Member
The default (no argument) contstructor for XmlTextReader is Protected. Maybe try using one of the Public constructors.
-
Apr 15th, 2004, 01:13 PM
#3
Thread Starter
New Member
Could I see an example of how that is done?
-
Apr 15th, 2004, 02:12 PM
#4
Frenzied Member
Check out MSDN - lots of good examples. But here's a snippet:
VB Code:
Dim sr As New StreamReader("c:\temp\myfile.xml")
Dim xtr As New XmlTextReader(sr)
While xtr.Read
Debug.WriteLine(xtr.LineNumber)
End While
xtr.Close()
sr.Close()
-
Apr 15th, 2004, 02:13 PM
#5
Thread Starter
New Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|