Closed Thread
Results 1 to 4 of 4

Using IndexOf, Split etc - how to import the namespace/library?

  1. #1
    Registered User
    Join Date
    04-23-2011
    Location
    Hawaii
    MS-Off Ver
    Excel 2007
    Posts
    4

    Using IndexOf, Split etc - how to import the namespace/library?

    So my goal is that I want a pick list that when I select values from it, it adds the newly selected value comma separated from the previous values - essentially allowing the user to select multiple options from the pick list.

    I googled and I have working code which does just this, the only problem is that nothing stops the user from selecting the same item over and over, and the items end up out of order. I want to split the string into an array of strings using Split(), and sorting it alphabetically, and if the newly chosen item already exists, then it isn't appended onto the list.

    The problem I am having is that I can't figure out how to import the libraries / namespaces that the functions Split(), IndexOf(), Array.Sort(), etc. are involved in.

    Here is a link to the code I have so far - the IndexOf line isn't recognized, and "Imports System" at the top results in an "Invalid Outside Procedure" error.

    http://pastebin.com/raw.php?i=yBw4NKXw

    Any help or guidance would be really appreciated - thanks!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Using IndexOf, Split etc - how to import the namespace/library?

    Hello opsayo,

    Welcome to the Forum!

    I am not sure you will get an answer to your question in this forum. Your question is about VB.Net programming. This forum is for VBA programming.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    04-23-2011
    Location
    Hawaii
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Using IndexOf, Split etc - how to import the namespace/library?

    Quote Originally Posted by Leith Ross View Post
    Hello opsayo,

    Welcome to the Forum!

    I am not sure you will get an answer to your question in this forum. Your question is about VB.Net programming. This forum is for VBA programming.
    Thanks Leith. Before I post this in another forum, what is the exact difference between VB.net and VBA programming? All I knew was that I was trying to code a macro in visual basic for an Excel spreadsheet.

    Thanks!

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2003
    Location
    British Columbia , Canada
    MS-Off Ver
    03,07,10,13
    Posts
    727

    Re: Using IndexOf, Split etc - how to import the namespace/library?

    In this demo I take a comma seperated list that is out of order and contains duplicates ... the resulting comma seperated list is in order and contains no duplicates...Is that what you looking for ?

    Please Login or Register  to view this content.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1