CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Loading Item from a Combo Box

    Hi,
    I am new to ASP development.I have a COM Object running in MTS.
    I want to populate the values in a combo box using the object Function.
    Can anyone send me the coding ?
    Thanx in Advance.

    Regards,
    Ram


  2. #2
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: Loading Item from a Combo Box

    What type of object is your MTS component returning? Are you trying to load a combo box with records from a recordset? or just a collection of custom objects. In either case, the below should give a good idea of where to start:

    'this example assumes you are filling a drop down combo with records from a recordset named rs
    'yourpage.asp
    'create the object, make the call to return the recordset.
    'now fill the combo box:

    dim str 'as string - to hold the HTML to build the control on the client side

    'start the control's HTML code
    str = "<Select name=ControlName>" & vbcrlf
    While Not rs.EOF
    'for each record in the rs, add a selection to the combo box
    'the value parameter is required and can be a different value than that shown. this value is the
    'value posted from the form (if you are using a form)
    str = str & "<option value='" & rs(FieldName) & "'>" & rs(FieldName) & "</option>" & vbcrlf
    rs.movenext
    wend

    str = str & "</select>"

    response.write str




    Hope this helps/applies,
    John

    John Pirkey
    MCSD
    www.ShallowWaterSystems.com
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

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

Featured