Results 1 to 3 of 3

Thread: [RESOLVED]'>' is an unexpected token

  1. #1

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Resolved [RESOLVED]'>' is an unexpected token

    I copied the code from one of my other applications, it contains a datagrid x2 text boxes and x2 buttons and a resource file.

    I am getting this error:

    Code:
    '>' is an unexpected token. The expected token is '='. Line 4, position 14.
    In relation to the tr

    ds.ReadXml(tr)

    I don't understand, everything works fine on the other form yet on this one it bugs out.

    Code:
    Imports System.Xml
    Imports System.Data
    
    Public Class Form4
        Private Property iChildFormNumber As Integer
        Dim ds As New DataSet
        Private Sub Form4_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Dim tr As New System.IO.StringReader(My.Resources.Errors)
            ds.ReadXml(tr)
            DataGridView1.DataSource = ds.Tables(0)
        End Sub
        Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles Errorcode.TextChanged
            ds.Tables(0).DefaultView.RowFilter = "[Error Code] like '%" & Errorcode.Text & "%'"
            DataGridView1.DataSource = ds.Tables(0)
        End Sub
        Private Sub Result_TextChanged(sender As Object, e As EventArgs) Handles Result.TextChanged
            ds.Tables(0).DefaultView.RowFilter = "[Result] like '%" & Result.Text & "%'"
            DataGridView1.DataSource = ds.Tables(0)
        End Sub
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Errorcode.Text = ""
        End Sub
        Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
            Result.Text = ""
        End Sub
    End Class
    Original Code

    Code:
    Imports System.Xml
    Imports System.Data
    Public Class Form1
        'Added 8th May 2013
        Private WithEvents pd As New Printing.PrintDocument
        Private WithEvents ppd As New PrintPreviewDialog
        'Added 8th May 2013 Above
    
    
        Private Property iChildFormNumber As Integer
        Dim ds As New DataSet
        Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim tr As New System.IO.StringReader(My.Resources.PhoneData)
            ds.ReadXml(tr)
            DataGridView1.DataSource = ds.Tables(0)
        End Sub
        Private Sub btnMobileDeviceFilter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMobileDeviceFilter.Click
            ds.Tables(0).DefaultView.RowFilter = "[Mobile] like '%" & tbMobileDevice.Text & "%'"
            DataGridView1.DataSource = ds.Tables(0)
        End Sub
        Private Sub btnSimType_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSimType.Click
            ds.Tables(0).DefaultView.RowFilter = "[SIM] like '%" & tbSIMType.Text & "%'"
            DataGridView1.DataSource = ds.Tables(0)
        End Sub
        Private Sub btnWebsiteLinkFilter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWebsiteLinkFilter.Click
            ds.Tables(0).DefaultView.RowFilter = "[Specs] like '%" & tbWebsiteLink.Text & "%'"
            DataGridView1.DataSource = ds.Tables(0)
        End Sub
        Private Sub tbMobileDevice_TextChanged(sender As Object, e As EventArgs) Handles tbMobileDevice.TextChanged
            ds.Tables(0).DefaultView.RowFilter = "[Mobile] like '%" & tbMobileDevice.Text & "%'"
            DataGridView1.DataSource = ds.Tables(0)
        End Sub
        Private Sub tbSIMType_TextChanged(sender As Object, e As EventArgs) Handles tbSIMType.TextChanged
            ds.Tables(0).DefaultView.RowFilter = "[SIM] like '%" & tbSIMType.Text & "%'"
            DataGridView1.DataSource = ds.Tables(0)
        End Sub
        Private Sub tbWebsiteLink_TextChanged(sender As Object, e As EventArgs) Handles tbWebsiteLink.TextChanged
            ds.Tables(0).DefaultView.RowFilter = "[Specs] like '%" & tbWebsiteLink.Text & "%'"
            DataGridView1.DataSource = ds.Tables(0)
        End Sub
        Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
            tbMobileDevice.Text = ""
        End Sub
        Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
            tbSIMType.Text = ""
        End Sub
        Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
            tbWebsiteLink.Text = ""
        End Sub
        'Added 8th May 2013
        Private Sub pd_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles pd.PrintPage
            Dim startX As Integer = 50
            Dim startY As Integer = 50
    
            Dim sf As New StringFormat
            sf.Alignment = StringAlignment.Near
            sf.LineAlignment = StringAlignment.Center
    
            Dim cells() As DataGridViewCell = DataGridView1.SelectedCells.Cast(Of DataGridViewCell).OrderBy(Function(c) c.OwningRow.Index).ThenBy(Function(c) c.OwningColumn.Index).ToArray
    
            For x As Integer = 0 To cells.Count - 1
                Dim cell As DataGridViewCell = cells(x)
                e.Graphics.DrawRectangle(Pens.Black, New Rectangle(startX, startY, cell.Size.Width, cell.Size.Height))
                e.Graphics.DrawString(cell.Value.ToString, DataGridView1.Font, Brushes.Black, New Rectangle(startX, startY, cell.Size.Width, cell.Size.Height), sf)
                If x < cells.Count - 1 AndAlso cells(x + 1).OwningRow Is cells(x).OwningRow Then
                    startX += cell.Size.Width
                End If
                If x < cells.Count - 1 AndAlso cells(x + 1).OwningRow IsNot cells(x).OwningRow Then
                    startX = 50
                    startY += cell.Size.Height
                End If
            Next
    
        End Sub
        
    End Class
    Last edited by jokerfool; Jun 12th, 2013 at 08:09 PM.

  2. #2

    Re: '>' is an unexpected token

    Why don't you post the XML instead...?


    EDIT: To elaborate on my question, your error is happening on the line of:

    Code:
    ds.ReadXml(tr)
    So, if that LINE is throwing the exception, perhaps posting the relevant information (such as, what the heck TR is when that line is hit) would be fantastic for debugging. Your error message even says:
    Quote Originally Posted by error message
    '>' is an unexpected token. The expected token is '='. Line 4, position 14.
    That's obviously not a compilation problem. That appears to be a runtime exception. It's the little logical deductions that make everyone involved in assisting easier. I'm not trying to be mean or rude, just being blunt.
    Last edited by formlesstree4; Jun 12th, 2013 at 07:58 PM.

  3. #3

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Re: '>' is an unexpected token

    All good worked it out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width