Results 1 to 5 of 5

Thread: Using 2 for every statements?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    78

    Using 2 for every statements?

    is there any way to use 2 for every.... statements?

    i want to load up my.settings and 1 list will make new toolstripdropdownitem and the other lists is for the tooltiptexts

    or I could do it another way, but how can I check the index of items in a my.setting string collection? like if I want to get the text of index number 3 how do I do that? thanks

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: Using 2 for every statements?

    The fact that it's from My.Settings is irrelevant. A StringCollection is a StringCollection, and a StringCollection is basically the same as any other collection. If you want to get the String at index 3 then that's exactly what you do:
    vb.net Code:
    1. myString = myStringCollection(3)
    I think what you want is actually simpler than you think. You can use a For Each loop and then use the current item inside the loop several times, e.g.
    vb.net Code:
    1. For Each str In My.Settings.MyStringCollection
    2.     'Use str here to create a menu item.
    3.  
    4.     'Use str here to create a tool tip.
    5. Next

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    78

    Re: Using 2 for every statements?

    hmm... I don't really understand the loop thing, but I'll try the mystring = mystringcollection(3) thing

    so for me would i do

    my.settings.(name)(indexnumber)

    ?

    let me try

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    78

    Re: Using 2 for every statements?

    using the for each str in my.settings.ddml (ddml is my string collection name)

    i get an error saying like str needs a value or something.... like a number or i dunno

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    78

    Re: Using 2 for every statements?

    o wait nevermind i got my.settings.ddm(number) to work thanks

    i dunno wat i was doing before but thanks very much ur awesome

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
  •  



Click Here to Expand Forum to Full Width