I don't actually know how to start this because I haven't touched the .NET for quite some time, usually this isn't an issue for me, but for the life of me I can't remember.
2 files. 1 form and 1 XML
XML:
When I only have one lot of information E.G.:Code:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Table xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Device> <Recipe>Axe</Recipe> <Rarity>Basic</Rarity> <Author>testuser</Author> <Information>Information here123</Information> </Device> <Device> <Recipe>Axe</Recipe> <Rarity>Basic</Rarity> <Author>testuser</Author> <Information>Information here123</Information> </Device> </Table>
Code:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Table xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Device> <Recipe>Axe</Recipe> <Rarity>Basic</Rarity> <Author>testuser</Author> <Information>Information here123</Information> </Device> </Table>
And I run the application, it runs fine displaying the contents in the Datagrid. When I add a second set of information I get the error:
This is my formCode:Could not find schema information for the element
I am in the process of adding the option so when I type into the search it scans through the text and starts displaying the results, hence why I have leave lines still in there e.g. :Code:Imports System.Xml Imports System.Data Public Class Form1 Private WithEvents pd As New Printing.PrintDocument Private WithEvents ppd As New PrintPreviewDialog 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.Recipes) ds.ReadXml(tr) DataGridView1.DataSource = ds.Tables(0) End Sub Private Sub btnRecipesFilter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRecipesFilter.Click ds.Tables(0).DefaultView.RowFilter = "[Recipe] like '%" & tbRecipes.Text & "%'" DataGridView1.DataSource = ds.Tables(0) End Sub Private Sub btnRarity_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRarity.Click ds.Tables(0).DefaultView.RowFilter = "[Rarity] like '%" & tbRarity.Text & "%'" DataGridView1.DataSource = ds.Tables(0) End Sub Private Sub btnAuthorFilter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAuthorFilter.Click ds.Tables(0).DefaultView.RowFilter = "[Author] like '%" & tbAuthor.Text & "%'" DataGridView1.DataSource = ds.Tables(0) End Sub Private Sub btnInformationFilter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInformationFilter.Click ds.Tables(0).DefaultView.RowFilter = "[Information] like '%" & tbInformation.Text & "%'" DataGridView1.DataSource = ds.Tables(0) End Sub Private Sub tbRecipes_TextChanged(sender As Object, e As EventArgs) Handles tbRecipes.TextChanged ds.Tables(0).DefaultView.RowFilter = "[Recipes] like '%" & tbRecipes.Text & "%'" DataGridView1.DataSource = ds.Tables(0) End Sub Private Sub tbRarity_TextChanged(sender As Object, e As EventArgs) Handles tbRarity.TextChanged ds.Tables(0).DefaultView.RowFilter = "[Rarity] like '%" & tbRarity.Text & "%'" DataGridView1.DataSource = ds.Tables(0) End Sub Private Sub tbAuthor_TextChanged(sender As Object, e As EventArgs) Handles tbAuthor.TextChanged ds.Tables(0).DefaultView.RowFilter = "[Author] like '%" & tbAuthor.Text & "%'" DataGridView1.DataSource = ds.Tables(0) End Sub Private Sub tbInformation_TextChanged(sender As Object, e As EventArgs) Handles tbInformation.TextChanged ds.Tables(0).DefaultView.RowFilter = "[Information] like '%" & tbInformation.Text & "%'" DataGridView1.DataSource = ds.Tables(0) End Sub Private Sub PrintToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles PrintToolStripMenuItem.Click ppd.Document = pd ppd.WindowState = FormWindowState.Maximized ppd.ShowDialog() End Sub Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) ' this assumes that the selection will fit on a single page ' it gets rather more complicated if you want multipage e.Graphics.DrawString(My.Computer.Clipboard.GetDataObject.GetData("Text", True).ToString, DataGridView1.Font, Brushes.Black, New Point(0, 0)) End Sub 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
Any ideas please.Code:ds.Tables(0).DefaultView.RowFilter = "[Recipe] like '%" & tbRecipes.Text & "%'" DataGridView1.DataSource = ds.Tables(0)
Thank you.


Reply With Quote
