Reputation: 151 Stalwart
- Active Posts:
- 954 (0.51 per day)
- 16-March 09
- Profile Views:
- Last Active:
- Jul 03 2012 11:42 AM
- OS Preference:
- Favorite Browser:
- Favorite Processor:
- Favorite Gaming Platform:
- Your Car:
- Dream Kudos:
Posts I've Made
Posted 29 Jun 2012I'm actually using this line on a project I'm working on right now.
Works if i move it to another directory or to another machine.
Application.StartupPath & "\filename.extension"
Posted 29 Jun 2012Not against literals just have never used them before to be honest.
I'll look into them for sure ;-) never hurts to know about it, but for this project I'll just roll with what I have. It's not a super crazy important program, it's mainly for a work around for about 3-4 weeks until the FTP sources are not needed any longer.
Thanks for your help guys always a treat ;-)
Posted 29 Jun 2012sure ... it's just in my main_load
Private Sub main_Load(sender As Object, e As System.EventArgs) Handles Me.Load Try ' pull the current settings file Dim objStreamReader As New StreamReader(Application.StartupPath & "\sm.xml") Dim x As New XmlSerializer(GetType(myFTP)) siteManager = x.Deserialize(objStreamReader) objStreamReader.Close() For Each aConfig In siteManager.configs For Each aServer As Server In aConfig.servers profileList.Items.Add(aServer.Name) Next Next Catch ex As Exception MsgBox(ex.ToString) End Try End Sub
I have not gotten to the point of testing how everything looks when i serialize it back to an XML.
Posted 29 Jun 2012ugly ugly ugly ... lol
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <myFTP> <Servers> <Server> <Name>FTP Host 1</name> <Host>ftp1.host.com</Host> <Port>21</Port> <User>ftpuser</User> <Pass>ftppass</Pass> FTP Host 1 </Server> <Server> <Name>FTP Host 2</name> <Host>ftp2.host.com</Host> <Port>21</Port> <User>ftpuser</User> <Pass>ftppass</Pass> FTP Host 2 </Server> </Servers> <Servers></Servers> </myFTP>
<Serializable()> _ <XmlRoot("myFTP")> _ Public Class myFTP <XmlElement("Servers")> _ Public configs As List(Of Servers) End Class Public Class Servers <XmlElement("Server")> _ Public servers As List(Of Server) End Class
For Each aConfig In siteManager.configs For Each aServer As Server In aConfig.servers profileList.Items.Add(aServer.Name) Next Next
works just not as clean as I would like to do it ... still can't figure out how to read that text value of the node <server>, if it's even possible. I really don't need it but would prefer to know how to deal with it.
Posted 29 Jun 2012Meh, I didn't even realize I left the module declaration there thanks for that.
<Serializable()> _ <XmlRoot("myFTP")> _ Public Class myFTP Public servers As List(Of Server) End Class
The downside is now it doesn't iterate the server nodes under servers. So the collection is empty.
It's only iterating the Servers nodes, that's why I had an extra class as Servers before, which i did because it made it iterate both the servers parent node and the server chil nodes under the servers.
- Member Title:
- // Note to self: hmphh .... I forgot
- 31 years old
- March 12, 1983
- Rosharon, Texas USA
By profession and hobby i love computers, networking, and a new found interest in programming ( web and newly discovered windows programs )
PC FPS online gaming
Also race cars when i find time :)
- Years Programming:
- Programming Languages:
All are in learning processes and self-taught (also with help from countless forums like this one )
New to me is .NET, C++
- Website URL: