Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2010
    Posts
    1

    Help inserting variable in the middle of a url

    I need help with some syntax,

    I need to have the value of a drop down box inserted into the middle of a url string,

    e.g.:

    Selected Value in drop down box "OEM"

    URL I needed: http://www.somesearch.com/search?value0=OEM%3type=boolean%3value2=otherval%3

    As you can see I need to take the data of the selected entry in the list box and insert it into the middle of the url string in this example the data is "OEM"

  2. #2
    Join Date
    May 2001
    Location
    51.531249 | -0.610962
    Posts
    1,244
    Depends how your working with the url. In your example, is OEM the only bit that changes?

    If http://www.somesearch.com/search?value0= and %3type=boolean%3value2=otherval%3 are constant then you simply concat the 3 strings
    Otherwise it could prove awkward if the url is aways changing - but im sure you know this already.
    -
    = Derek
    ["All glory comes from daring to begin" - fortune cookie]

  3. #3
    Join Date
    Aug 2003
    Posts
    2,427
    You say "in this example" so I'm not sure that this is exactly what you want but something along the lines of -
    Code:
    turl="http://www.somesearch.com/search?value0=%3type=boolean%3value2=otherval%3"
    len = String.Length(turl);
    pos = String.Find(turl, "value0=", 1, false);
    turlleft = String.Left(turl, pos+6)
    turlright = String.Right(turl, len-(pos+6))
    tnewurl = turlleft.."OEM"..turlright
    p.s. - pipped at the post

  4. #4
    Join Date
    Oct 2009
    Location
    127.0.0.1
    Posts
    279
    Seems like you would need something more like this:

    Code:
    String = "http://www.somesearch.com/search?value0="..ComboBox.GetItemData("ComboBox1", ComboBox.GetSelected()).."%3type=boolean%3value2=otherval%3"
    This would return a string with the Data from the combobox selection in the actual URL.
    There are 10 types of people in the world: those who understand binary, and those who don't.

Posting Permissions

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