|
-
May 29th, 2011, 08:17 PM
#1
Thread Starter
Member
xml file count help
I have over 4,000 xml files that needs to be converted in to a character based on a value and entered in to a rich text box. It will do this, until it runs out of files to read. I have tried "try" statements, "if" statements... I can't figure out how to fix the issue. I searched the forums with no results. Kinda makes me feel special 
Code:
Imports System.Xml
Imports System.IO
Imports System
Imports Microsoft.VisualBasic
Public Class frmNavigation
Public m_Xcoord As String
Public m_Ycoord As String
Public m_ResourceValue As String
Public m_MResource As String
Public m_RResource As String
Dim xmlDirectory As String = "C:\Users\Josh\Documents\Visual Studio 2010\Projects\xmlCreator\xmlCreator\bin\Debug\worlds\glation"
Dim xmlFile As String = "C:\Users\Josh\Documents\Visual Studio 2010\Projects\xmlCreator\xmlCreator\bin\Debug\worlds\glation\glation"
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
Dim TempFile As String = "C:\Users\Josh\Documents\Visual Studio 2010\Projects\xmlCreator\xmlCreator\bin\Debug\worlds\glation\glation1.xml"
Dim Reader As Xml.XmlReader
Dim NewYcoord As String = "1"
Dim xmlFileCount As String = "0"
System.IO.Directory.SetCurrentDirectory(xmlDirectory)
Reader = Xml.XmlReader.Create(TempFile)
Do Until Reader.EOF = True
xmlFileCount = xmlFileCount + 1
xmlFile = xmlFile & xmlFileCount & ".xml"
If File.Exists(xmlFile) Then
Reader = Xml.XmlReader.Create(xmlFile)
Reader.ReadToFollowing("Xcoord")
m_Xcoord = Reader.ReadElementString("Xcoord")
m_Ycoord = Reader.ReadElementString("Ycoord")
Reader.ReadToFollowing("Resource")
m_ResourceValue = Reader.ReadElementString("Resource")
m_MResource = Reader.ReadElementString("Mountain")
m_RResource = Reader.ReadElementString("River")
xmlFile = "C:\Users\Josh\Documents\Visual Studio 2010\Projects\xmlCreator\xmlCreator\bin\Debug\worlds\glation\glation"
If m_Xcoord = 110 Then
NewYcoord = NewYcoord + 1
End If
If NewYcoord > m_Ycoord Then
rtbViewMap.Text = rtbViewMap.Text & vbCrLf
End If
If m_ResourceValue = "300" Then
rtbViewMap.Text = rtbViewMap.Text & "#"
ElseIf m_ResourceValue = "200" Then
rtbViewMap.Text = rtbViewMap.Text & "."
ElseIf m_ResourceValue = "100" Then
rtbViewMap.Text = rtbViewMap.Text & ";"
ElseIf m_ResourceValue = "0" And m_MResource = "0" And m_RResource = "0" Then
rtbViewMap.Text = rtbViewMap.Text & "%"
ElseIf m_MResource = "150" And m_RResource = "0" Then
rtbViewMap.Text = rtbViewMap.Text & "^"
ElseIf m_RResource = "70" And m_MResource = "0" Then
rtbViewMap.Text = rtbViewMap.Text & "~"
End If
End If
Loop
End Sub
End Class
Tags for this Thread
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
|