Microsoft.VisualBasic.Collection replacement?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Charles Law

    #16
    Re: Microsoft.Visua lBasic.Collecti on replacement?

    Hi Cor

    I hadn't thought of the dataset, I suppose because I tend to think of it
    more as a database orientated class, but I will take a look now.

    Thanks

    Charles


    "Cor" <non@non.com> wrote in message
    news:O9yL8PVGEH A.3856@TK2MSFTN GP12.phx.gbl...[color=blue]
    > Hi Charles,
    >
    > What is against the dataset it has everything you are asking for build in[/color]
    in[color=blue]
    > my opinion?
    >
    > Cor
    >
    >[/color]


    Comment

    • Charles Law

      #17
      Re: Microsoft.Visua lBasic.Collecti on replacement?

      Hi Cor

      I hadn't thought of the dataset, I suppose because I tend to think of it
      more as a database orientated class, but I will take a look now.

      Thanks

      Charles


      "Cor" <non@non.com> wrote in message
      news:O9yL8PVGEH A.3856@TK2MSFTN GP12.phx.gbl...[color=blue]
      > Hi Charles,
      >
      > What is against the dataset it has everything you are asking for build in[/color]
      in[color=blue]
      > my opinion?
      >
      > Cor
      >
      >[/color]


      Comment

      • Jay B. Harlow [MVP - Outlook]

        #18
        Re: Microsoft.Visua lBasic.Collecti on replacement?

        Charles,
        Unfortunately I do not do a lot of XML serialization, so I currently do not
        have an answer for you, other then what I stated in the other thread.

        Also are you referring to the XML serializer or the SOAP serializer? They
        are different: one is used the same as BinarySerilazer , while the other is
        used for Web Services, my understanding is that the SOAP serializer is more
        limited as SOAP is more limited. HOwever I have not done a lot with either
        SOAP or XML serialization.

        Hope this helps
        Jay

        "Charles Law" <blank@nowhere. com> wrote in message
        news:uP80kIVGEH A.2980@TK2MSFTN GP09.phx.gbl...[color=blue]
        > Hi Jay
        >
        > I'm not really trying to hijack this thread, but it continues to touch on
        > areas that currently concern me as well.
        >
        > With respect to the specific question of collections, I too have been
        > looking for a ready-made collection that supports key and item, is[/color]
        sortable,[color=blue]
        > but can also be serialised using the XML serialiser. Whilst the[/color]
        suggestions[color=blue]
        > you make separately fulfil parts of these goals, I don't think any one of
        > them is the full Monty (e.g. anything using IDictionary cannot be
        > automatically serialised) ... but I may be wrong.
        >
        > Can you suggest a solution with these aims in mind?
        >
        > Thanks.
        >
        > Charles
        >
        >
        > "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP @msn.com> wrote in message
        > news:OgabY1QGEH A.2876@TK2MSFTN GP09.phx.gbl...[color=green]
        > > Craig,
        > > As the others have suggested you could continue to use
        > > Microsoft.Visua lBasic.Collecti on.
        > >
        > > Alternatively you can start with CollectionBase and add a contained
        > > HashTable, or start with DictionaryBase and add a contained ArrayList.[/color]
        > Then[color=green]
        > > simply add two Item properties one for Integer & one for String.
        > >
        > > A Third "better" alternative may be to start with
        > > System.Collecti ons.Specialized .NameObjectColl ectionBase and add two Item
        > > properties.
        > >
        > > There are a couple of other collections (NameValueColle ction for[/color][/color]
        example)[color=blue]
        > in[color=green]
        > > System.Collecti ons.Specialized that may be useful also.
        > >
        > > I prefer to start with CollectionBase, DictionaryBase, or
        > > NameObjectColle ctionBase as they allow me to have type safe collections!
        > >
        > > Hope this helps
        > > Jay
        > >
        > > "Craig Buchanan" <someone@micros oft.com> wrote in message
        > > news:e9NQbhNGEH A.696@TK2MSFTNG P12.phx.gbl...[color=darkred]
        > > > Which vb.net object is the best match for the vb6 collection class?
        > > > Specifically, I would like to be able to access the Item property with[/color][/color]
        > an[color=green][color=darkred]
        > > > index or a key string.
        > > >
        > > > I wrote my own class that inherits from the collectionbase and uses an
        > > > arraylist to hold values, but i'm missing the Item(string) property.[/color][/color][/color]
        I[color=blue][color=green][color=darkred]
        > > > suppose I could iterate thru the collection and look for a string[/color][/color][/color]
        match,[color=blue][color=green]
        > > but[color=darkred]
        > > > I thought there might be an easier way.
        > > >
        > > > Thanks,
        > > >
        > > > Craig
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Jay B. Harlow [MVP - Outlook]

          #19
          Re: Microsoft.Visua lBasic.Collecti on replacement?

          Charles,
          Unfortunately I do not do a lot of XML serialization, so I currently do not
          have an answer for you, other then what I stated in the other thread.

          Also are you referring to the XML serializer or the SOAP serializer? They
          are different: one is used the same as BinarySerilazer , while the other is
          used for Web Services, my understanding is that the SOAP serializer is more
          limited as SOAP is more limited. HOwever I have not done a lot with either
          SOAP or XML serialization.

          Hope this helps
          Jay

          "Charles Law" <blank@nowhere. com> wrote in message
          news:uP80kIVGEH A.2980@TK2MSFTN GP09.phx.gbl...[color=blue]
          > Hi Jay
          >
          > I'm not really trying to hijack this thread, but it continues to touch on
          > areas that currently concern me as well.
          >
          > With respect to the specific question of collections, I too have been
          > looking for a ready-made collection that supports key and item, is[/color]
          sortable,[color=blue]
          > but can also be serialised using the XML serialiser. Whilst the[/color]
          suggestions[color=blue]
          > you make separately fulfil parts of these goals, I don't think any one of
          > them is the full Monty (e.g. anything using IDictionary cannot be
          > automatically serialised) ... but I may be wrong.
          >
          > Can you suggest a solution with these aims in mind?
          >
          > Thanks.
          >
          > Charles
          >
          >
          > "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP @msn.com> wrote in message
          > news:OgabY1QGEH A.2876@TK2MSFTN GP09.phx.gbl...[color=green]
          > > Craig,
          > > As the others have suggested you could continue to use
          > > Microsoft.Visua lBasic.Collecti on.
          > >
          > > Alternatively you can start with CollectionBase and add a contained
          > > HashTable, or start with DictionaryBase and add a contained ArrayList.[/color]
          > Then[color=green]
          > > simply add two Item properties one for Integer & one for String.
          > >
          > > A Third "better" alternative may be to start with
          > > System.Collecti ons.Specialized .NameObjectColl ectionBase and add two Item
          > > properties.
          > >
          > > There are a couple of other collections (NameValueColle ction for[/color][/color]
          example)[color=blue]
          > in[color=green]
          > > System.Collecti ons.Specialized that may be useful also.
          > >
          > > I prefer to start with CollectionBase, DictionaryBase, or
          > > NameObjectColle ctionBase as they allow me to have type safe collections!
          > >
          > > Hope this helps
          > > Jay
          > >
          > > "Craig Buchanan" <someone@micros oft.com> wrote in message
          > > news:e9NQbhNGEH A.696@TK2MSFTNG P12.phx.gbl...[color=darkred]
          > > > Which vb.net object is the best match for the vb6 collection class?
          > > > Specifically, I would like to be able to access the Item property with[/color][/color]
          > an[color=green][color=darkred]
          > > > index or a key string.
          > > >
          > > > I wrote my own class that inherits from the collectionbase and uses an
          > > > arraylist to hold values, but i'm missing the Item(string) property.[/color][/color][/color]
          I[color=blue][color=green][color=darkred]
          > > > suppose I could iterate thru the collection and look for a string[/color][/color][/color]
          match,[color=blue][color=green]
          > > but[color=darkred]
          > > > I thought there might be an easier way.
          > > >
          > > > Thanks,
          > > >
          > > > Craig
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Jay B. Harlow [MVP - Outlook]

            #20
            Re: Microsoft.Visua lBasic.Collecti on replacement?

            Cor,
            A Dataset is used to contain a set or Data Rows.

            A Collection is used to contain a set of objects.

            Being an Object Oriented programmer, I find containing a set of objects is
            much more powerful then containing a set of Data rows.

            Unfortunately I do not have a good resource on when you should choose a Data
            Centric (DataSet) approach or an Object Oriented approach. Although I find
            keeping both options available is far better then saying. We are only using
            one or the other!

            Hope this helps
            Jay

            "Cor" <non@non.com> wrote in message
            news:O9yL8PVGEH A.3856@TK2MSFTN GP12.phx.gbl...[color=blue]
            > Hi Charles,
            >
            > What is against the dataset it has everything you are asking for build in[/color]
            in[color=blue]
            > my opinion?
            >
            > Cor
            >
            >[/color]


            Comment

            • Jay B. Harlow [MVP - Outlook]

              #21
              Re: Microsoft.Visua lBasic.Collecti on replacement?

              Cor,
              A Dataset is used to contain a set or Data Rows.

              A Collection is used to contain a set of objects.

              Being an Object Oriented programmer, I find containing a set of objects is
              much more powerful then containing a set of Data rows.

              Unfortunately I do not have a good resource on when you should choose a Data
              Centric (DataSet) approach or an Object Oriented approach. Although I find
              keeping both options available is far better then saying. We are only using
              one or the other!

              Hope this helps
              Jay

              "Cor" <non@non.com> wrote in message
              news:O9yL8PVGEH A.3856@TK2MSFTN GP12.phx.gbl...[color=blue]
              > Hi Charles,
              >
              > What is against the dataset it has everything you are asking for build in[/color]
              in[color=blue]
              > my opinion?
              >
              > Cor
              >
              >[/color]


              Comment

              • Cor Ligthert

                #22
                Re: Microsoft.Visua lBasic.Collecti on replacement?

                Hi Jay B,

                Did you see me giving an answer on Charles last question about the XML
                serializer, that is because I agree this with you (I am sad you even do
                think I am not).

                :-)

                However in this thread he was asking about a collection and in my simple
                mind it was a collection of data.

                So I pointed Charles on the dataset, because that is a very easy collection
                when it is all about data.

                And I was in doubt if I would look for Charles for the XML serializer
                because I did give someone an answer yesterday where that was in. However I
                decided to do that this time not. I do not know of the complexebility of the
                object Charles wants to serialize (which is mostly simple) and deserialize
                (which is mostly difficult) . And because Charles always start telling the
                question simple and than comes an "however I am using it in that way", I did
                it this time not, but decided to wait for that last one.

                :-)

                Cor





                Comment

                • Cor Ligthert

                  #23
                  Re: Microsoft.Visua lBasic.Collecti on replacement?

                  Hi Jay B,

                  Did you see me giving an answer on Charles last question about the XML
                  serializer, that is because I agree this with you (I am sad you even do
                  think I am not).

                  :-)

                  However in this thread he was asking about a collection and in my simple
                  mind it was a collection of data.

                  So I pointed Charles on the dataset, because that is a very easy collection
                  when it is all about data.

                  And I was in doubt if I would look for Charles for the XML serializer
                  because I did give someone an answer yesterday where that was in. However I
                  decided to do that this time not. I do not know of the complexebility of the
                  object Charles wants to serialize (which is mostly simple) and deserialize
                  (which is mostly difficult) . And because Charles always start telling the
                  question simple and than comes an "however I am using it in that way", I did
                  it this time not, but decided to wait for that last one.

                  :-)

                  Cor





                  Comment

                  • Charles Law

                    #24
                    Re: Microsoft.Visua lBasic.Collecti on replacement?

                    Hi Cor

                    You have found me out ;-) I do tend to keep my questions simple to start
                    with because I don't want to put people off having a go at answering. I also
                    cut out all the stuff that I don't think is relevant, and which might set
                    people thinking of an inappropriate solution.

                    The serialiser question is a good example. With each post I have added some
                    extra detail. I generally like to find things out for myself, because I
                    think I will learn and remember better that way, so I also don't seek for
                    people to give me the full answer but just a nudge in the right direction.

                    In this case, though, I have seen many posts on this subject which allude to
                    the same thing, that there is no direct replacement for the
                    VisualBasic.Col lection. That is a shame, because many people find that it
                    has exactly what they want from a collection.

                    As for serialising, I get the impression that not being able to serialise a
                    class that implements IDictionary (without hand-coding) is a short-coming,
                    and therefore may be added later by Microsoft. I hope so anyway.

                    Regards

                    Charles


                    "Cor Ligthert" <notfirstname@p lanet.nl> wrote in message
                    news:e6QEnykHEH A.3276@TK2MSFTN GP09.phx.gbl...[color=blue]
                    > Hi Jay B,
                    >
                    > Did you see me giving an answer on Charles last question about the XML
                    > serializer, that is because I agree this with you (I am sad you even do
                    > think I am not).
                    >
                    > :-)
                    >
                    > However in this thread he was asking about a collection and in my simple
                    > mind it was a collection of data.
                    >
                    > So I pointed Charles on the dataset, because that is a very easy[/color]
                    collection[color=blue]
                    > when it is all about data.
                    >
                    > And I was in doubt if I would look for Charles for the XML serializer
                    > because I did give someone an answer yesterday where that was in. However[/color]
                    I[color=blue]
                    > decided to do that this time not. I do not know of the complexebility of[/color]
                    the[color=blue]
                    > object Charles wants to serialize (which is mostly simple) and deserialize
                    > (which is mostly difficult) . And because Charles always start telling the
                    > question simple and than comes an "however I am using it in that way", I[/color]
                    did[color=blue]
                    > it this time not, but decided to wait for that last one.
                    >
                    > :-)
                    >
                    > Cor
                    >
                    >
                    >
                    >
                    >[/color]


                    Comment

                    • Charles Law

                      #25
                      Re: Microsoft.Visua lBasic.Collecti on replacement?

                      Hi Cor

                      You have found me out ;-) I do tend to keep my questions simple to start
                      with because I don't want to put people off having a go at answering. I also
                      cut out all the stuff that I don't think is relevant, and which might set
                      people thinking of an inappropriate solution.

                      The serialiser question is a good example. With each post I have added some
                      extra detail. I generally like to find things out for myself, because I
                      think I will learn and remember better that way, so I also don't seek for
                      people to give me the full answer but just a nudge in the right direction.

                      In this case, though, I have seen many posts on this subject which allude to
                      the same thing, that there is no direct replacement for the
                      VisualBasic.Col lection. That is a shame, because many people find that it
                      has exactly what they want from a collection.

                      As for serialising, I get the impression that not being able to serialise a
                      class that implements IDictionary (without hand-coding) is a short-coming,
                      and therefore may be added later by Microsoft. I hope so anyway.

                      Regards

                      Charles


                      "Cor Ligthert" <notfirstname@p lanet.nl> wrote in message
                      news:e6QEnykHEH A.3276@TK2MSFTN GP09.phx.gbl...[color=blue]
                      > Hi Jay B,
                      >
                      > Did you see me giving an answer on Charles last question about the XML
                      > serializer, that is because I agree this with you (I am sad you even do
                      > think I am not).
                      >
                      > :-)
                      >
                      > However in this thread he was asking about a collection and in my simple
                      > mind it was a collection of data.
                      >
                      > So I pointed Charles on the dataset, because that is a very easy[/color]
                      collection[color=blue]
                      > when it is all about data.
                      >
                      > And I was in doubt if I would look for Charles for the XML serializer
                      > because I did give someone an answer yesterday where that was in. However[/color]
                      I[color=blue]
                      > decided to do that this time not. I do not know of the complexebility of[/color]
                      the[color=blue]
                      > object Charles wants to serialize (which is mostly simple) and deserialize
                      > (which is mostly difficult) . And because Charles always start telling the
                      > question simple and than comes an "however I am using it in that way", I[/color]
                      did[color=blue]
                      > it this time not, but decided to wait for that last one.
                      >
                      > :-)
                      >
                      > Cor
                      >
                      >
                      >
                      >
                      >[/color]


                      Comment

                      • Jay B. Harlow [MVP - Outlook]

                        #26
                        Re: Microsoft.Visua lBasic.Collecti on replacement?

                        Cor,
                        I was neither agreeing nor disagreeing with you! At the same time I was both
                        Agreeing & Disagreeing with you! ;-)

                        You made a statement, in the form of a question:
                        [color=blue]
                        > What is against the dataset it has everything you are asking
                        > for build in in my opinion?[/color]

                        I was answering the question, The fact a dataset can only hold data rows is
                        something significant against it.

                        If you are a Data centric programmer then yes, using a DataSet is fine. So
                        in this regard I was agreeing with you.

                        However I find significantly more value in being an Object Oriented
                        programmer, so a lot of times a DataSet is too limiting. So in this regard I
                        was disagreeing with you.

                        Remember Object Oriented thinking involves organizing your app by
                        responsibility & behaviors, not simply I have a collection of data...

                        As I stated, using a Data centric approach is appropriate sometimes and
                        using an Object Oriented approach is appropriate .

                        Hope this helps
                        Jay

                        "Cor Ligthert" <notfirstname@p lanet.nl> wrote in message
                        news:e6QEnykHEH A.3276@TK2MSFTN GP09.phx.gbl...[color=blue]
                        > Hi Jay B,
                        >
                        > Did you see me giving an answer on Charles last question about the XML
                        > serializer, that is because I agree this with you (I am sad you even do
                        > think I am not).
                        >
                        > :-)
                        >
                        > However in this thread he was asking about a collection and in my simple
                        > mind it was a collection of data.
                        >
                        > So I pointed Charles on the dataset, because that is a very easy[/color]
                        collection[color=blue]
                        > when it is all about data.
                        >
                        > And I was in doubt if I would look for Charles for the XML serializer
                        > because I did give someone an answer yesterday where that was in. However[/color]
                        I[color=blue]
                        > decided to do that this time not. I do not know of the complexebility of[/color]
                        the[color=blue]
                        > object Charles wants to serialize (which is mostly simple) and deserialize
                        > (which is mostly difficult) . And because Charles always start telling the
                        > question simple and than comes an "however I am using it in that way", I[/color]
                        did[color=blue]
                        > it this time not, but decided to wait for that last one.
                        >
                        > :-)
                        >
                        > Cor
                        >
                        >
                        >
                        >
                        >[/color]


                        Comment

                        • Jay B. Harlow [MVP - Outlook]

                          #27
                          Re: Microsoft.Visua lBasic.Collecti on replacement?

                          Cor,
                          I was neither agreeing nor disagreeing with you! At the same time I was both
                          Agreeing & Disagreeing with you! ;-)

                          You made a statement, in the form of a question:
                          [color=blue]
                          > What is against the dataset it has everything you are asking
                          > for build in in my opinion?[/color]

                          I was answering the question, The fact a dataset can only hold data rows is
                          something significant against it.

                          If you are a Data centric programmer then yes, using a DataSet is fine. So
                          in this regard I was agreeing with you.

                          However I find significantly more value in being an Object Oriented
                          programmer, so a lot of times a DataSet is too limiting. So in this regard I
                          was disagreeing with you.

                          Remember Object Oriented thinking involves organizing your app by
                          responsibility & behaviors, not simply I have a collection of data...

                          As I stated, using a Data centric approach is appropriate sometimes and
                          using an Object Oriented approach is appropriate .

                          Hope this helps
                          Jay

                          "Cor Ligthert" <notfirstname@p lanet.nl> wrote in message
                          news:e6QEnykHEH A.3276@TK2MSFTN GP09.phx.gbl...[color=blue]
                          > Hi Jay B,
                          >
                          > Did you see me giving an answer on Charles last question about the XML
                          > serializer, that is because I agree this with you (I am sad you even do
                          > think I am not).
                          >
                          > :-)
                          >
                          > However in this thread he was asking about a collection and in my simple
                          > mind it was a collection of data.
                          >
                          > So I pointed Charles on the dataset, because that is a very easy[/color]
                          collection[color=blue]
                          > when it is all about data.
                          >
                          > And I was in doubt if I would look for Charles for the XML serializer
                          > because I did give someone an answer yesterday where that was in. However[/color]
                          I[color=blue]
                          > decided to do that this time not. I do not know of the complexebility of[/color]
                          the[color=blue]
                          > object Charles wants to serialize (which is mostly simple) and deserialize
                          > (which is mostly difficult) . And because Charles always start telling the
                          > question simple and than comes an "however I am using it in that way", I[/color]
                          did[color=blue]
                          > it this time not, but decided to wait for that last one.
                          >
                          > :-)
                          >
                          > Cor
                          >
                          >
                          >
                          >
                          >[/color]


                          Comment

                          • Cor Ligthert

                            #28
                            Re: Microsoft.Visua lBasic.Collecti on replacement?

                            Hi Jay and Charles,

                            Thanks however, I did also thinking this over, two points do not forget the
                            extensibility of a dataset is limited by the very basic concepts of SQL.

                            (Jay you maybe know that I hate that "scripting" SQL language what you in my
                            opinion should do too because there is nothing less OOP than that in my
                            opinion) .

                            Another point I have thought on is that it is easy to put a serialized
                            string in a datarow. So my chalenge for the weekend is to fullfill the
                            question from Charles (I have seen samples so I hope it should go) and than
                            put them in a datarow, what is of course a piece of cake.

                            Hi Charles if this beneath is not what you mean, do than tell it to me?
                            --------------

                            XML serialization serializes only the public fields and property values of
                            an object into an XML stream. XML serialization does not include type
                            information. For example, if you have a Book object that exists in the
                            Library namespace, there is no guarantee that it will be deserialized into
                            an object of the same type.

                            ---------------

                            I hope that I can do it with this and do not need the memstream because than
                            it is already ready.
                            \\\
                            Dim x As XmlSerializer = new XmlSerializer(G etType(MyClass) )
                            Dim sw As New System.IO.Strin gWriter
                            x.Serialize(sw, MyObject)
                            ds.tables(0).ro ws(0)(0) = sw.tostring
                            ///

                            I did not do this serialization of an object before so I am not sure I
                            succeed.

                            And Charles when it is with this hint ready for tomorrow European Time, do
                            not forget to tell it to me.

                            :-))

                            Cor


                            Comment

                            • Cor Ligthert

                              #29
                              Re: Microsoft.Visua lBasic.Collecti on replacement?

                              Hi Jay and Charles,

                              Thanks however, I did also thinking this over, two points do not forget the
                              extensibility of a dataset is limited by the very basic concepts of SQL.

                              (Jay you maybe know that I hate that "scripting" SQL language what you in my
                              opinion should do too because there is nothing less OOP than that in my
                              opinion) .

                              Another point I have thought on is that it is easy to put a serialized
                              string in a datarow. So my chalenge for the weekend is to fullfill the
                              question from Charles (I have seen samples so I hope it should go) and than
                              put them in a datarow, what is of course a piece of cake.

                              Hi Charles if this beneath is not what you mean, do than tell it to me?
                              --------------

                              XML serialization serializes only the public fields and property values of
                              an object into an XML stream. XML serialization does not include type
                              information. For example, if you have a Book object that exists in the
                              Library namespace, there is no guarantee that it will be deserialized into
                              an object of the same type.

                              ---------------

                              I hope that I can do it with this and do not need the memstream because than
                              it is already ready.
                              \\\
                              Dim x As XmlSerializer = new XmlSerializer(G etType(MyClass) )
                              Dim sw As New System.IO.Strin gWriter
                              x.Serialize(sw, MyObject)
                              ds.tables(0).ro ws(0)(0) = sw.tostring
                              ///

                              I did not do this serialization of an object before so I am not sure I
                              succeed.

                              And Charles when it is with this hint ready for tomorrow European Time, do
                              not forget to tell it to me.

                              :-))

                              Cor


                              Comment

                              • Cor Ligthert

                                #30
                                Re: Microsoft.Visua lBasic.Collecti on replacement?

                                Hi Charles,

                                It was not that difficult.

                                It is a complete sample and I have placed also the dataset, and a combobox
                                to test.

                                The persons are from for us Benelux people from one of the famous Belgian
                                cartonists Vandersteen, that is because EricJ has often in his samples
                                Itemke, what is a kind of Dutch the Belgians always do and from which
                                Dutchman know it are Belgians.

                                I hope this helps you?

                                Cor

                                \\\
                                Private WithEvents combobox1 As New ComboBox
                                Private strt As Boolean
                                Private Sub Form1_Load(ByVa l sender As Object, _
                                ByVal e As System.EventArg s) Handles MyBase.Load
                                Dim Belgen As New BelgenCollectio n
                                Belgen.Add(New Belg(New String() {"Lambiek", "Man", "Jenever"}) )
                                Belgen.Add(New Belg(New String() {"Sidonia", "Vrouw", "Likeur"}))
                                Belgen.Add(New Belg(New String() {"Suske", "Jongen", "Cola"}))
                                Belgen.Add(New Belg(New String() {"Wiske", "Meisje", "Limonade"} ))
                                Belgen.Add(New Belg(New String() {"Jerom", "Jongeman", "Bier"}))
                                Dim Serializer As New
                                Xml.Serializati on.XmlSerialize r(GetType(Belge nCollection))
                                Dim sw As New System.IO.Strin gWriter
                                Serializer.Seri alize(sw, Belgen)
                                Dim ds As New DataSet
                                Dim dt As New DataTable("Jay" )
                                Dim dc As New DataColumn("Cha rles")
                                'This part only for Jay and Charles if he wants
                                dt.Columns.Add( dc)
                                ds.Tables.Add(d t)
                                dt.Rows.Add(dt. NewRow)
                                ds.Tables(0).Ro ws(0)(0) = sw.ToString
                                ds.WriteXml("c: \test1\charles. xml")
                                Dim dsJay As New DataSet
                                dsJay.ReadXml(" c:\test1\Charle s.xml")
                                Dim Charles As String = dsJay.Tables(0) .Rows(0)(0).ToS tring
                                'End Jay part
                                Dim Deserializer As New Xml.Serializati on.XmlSerialize r _
                                (GetType(Belgen Collection))
                                Dim sr As New System.IO.Strin gReader(Charles )
                                Dim reader As New System.Xml.XmlT extReader(sr)
                                Dim Vlamingen As BelgenCollectio n
                                Vlamingen = CType(Deseriali zer.Deserialize (reader), _
                                BelgenCollectio n)
                                Me.Controls.Add (combobox1)
                                combobox1.DataS ource = Vlamingen
                                strt = True
                                End Sub
                                Private Sub combobox1_Selec tedIndexChanged (ByVal _
                                sender As Object, ByVal e As System.EventArg s) _
                                Handles combobox1.Selec tedIndexChanged
                                If strt = True Then
                                MessageBox.Show (DirectCast(com bobox1.Selected Value, Belg).drank)
                                End If
                                End Sub
                                End Class
                                ///
                                \\\
                                Public Class Belg
                                Public Naam As String
                                Public sex As String
                                Public drank As String
                                Public Sub New()
                                End Sub
                                Public Sub New(ByVal fill As String())
                                Naam = fill(0)
                                sex = fill(1)
                                drank = fill(2)
                                End Sub
                                Public Overrides Function tostring() As String
                                Return Naam
                                End Function
                                End Class
                                Public Class BelgenCollectio n
                                Inherits System.Collecti ons.CollectionB ase
                                Default Public Overloads ReadOnly _
                                Property Item(ByVal index As Integer) As Belg
                                Get
                                Return DirectCast(list .Item(index), Belg)
                                End Get
                                End Property
                                Public Sub Add(ByVal aBelg As Belg)
                                List.Add(aBelg)
                                End Sub
                                End Class


                                Comment

                                Working...