Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / March 2008

Tip: Looking for answers? Try searching our database.

Further help required on classes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter Newman - 08 Mar 2008 13:20 GMT
Firstly a big thank you for the help pointing me in this direction, I have
managed to get this far ( section of code below) in reading a text file and
creating an XML file from it..

code
       Do
           Dim t As New Transaction
           importLine = StripQuotes(sr.ReadLine)
           If InStr(importLine, "TRAILER RECORD") Then Exit Do
           ' Set the values
           t.LedgerRef = s.LedgerKey
           t.Licence = s.License
           s.Transactions.Add(t)
       Loop Until InStr(importLine, "TRAILER RECORD") > 0

CLass

Imports System.Xml.Serialization
Imports System.IO

Public Class Transaction

   Public _LedgerRef As String
   <XmlAttribute("LedgerRef")> _
   Public Property LedgerRef() As String
       Get
           Return _LedgerRef
       End Get
       Set(ByVal value As String)
           _LedgerRef = value
       End Set
   End Property

           Public _Licence As String
   <XmlAttribute("Licence")> _
   Public Property Licence() As String
       Get
           Return _Licence
       End Get
       Set(ByVal value As String)
           _Licence = value
       End Set
   End Property

End Class

section ox XML result

 <Transactions>
   <Transaction LedgerRef="11111158908068131138" Licence="111111" >
     <_LedgerRef>11111158908068131138</_LedgerRef>
     <_Licence>111111</_Licence>
   </Transaction>
   <Transaction LedgerRef="22222258908068131138" Licence="222222" >
     <_LedgerRef>22222258908068131138</_LedgerRef>
     <_Licence>222222</_Licence>
   </Transaction>
.. etc

what im trying to achieve is the following

 <Transactions>
   <Transaction LedgerRef="11111158908068131138" Licence="111111" />
   <Transaction LedgerRef="22222258908068131138" Licence="222222" />

etc

any suggestions
Chris Dunaway - 10 Mar 2008 15:48 GMT
On Mar 8, 8:20 am, Peter Newman
<PeterNew...@discussions.microsoft.com> wrote:
> Firstly a big thank you for the help pointing me in this direction, I have
> managed to get this far ( section of code below) in reading a text file and
[quoted text clipped - 64 lines]
>
>  any suggestions

You didn't show the code where you actually create the XML so my guess
is the problem is there.  What you have posted seems ok at first
glance.

Chris
Chris Dunaway - 10 Mar 2008 15:49 GMT
On Mar 8, 8:20 am, Peter Newman
<PeterNew...@discussions.microsoft.com> wrote:
> Firstly a big thank you for the help pointing me in this direction, I have
> managed to get this far ( section of code below) in reading a text file and
[quoted text clipped - 64 lines]
>
>  any suggestions

Now at second glance, I think I see your problem.  Your property
backing fields should be private not public:

Public _Licence As String

should be

Private _Licence As String

And the same for _LedgerRef

Chris

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.