Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vb Style combo box issues

Status
Not open for further replies.

summron

Programmer
Jan 29, 2002
1
US
I added a vb style combo box like this:

<OBJECT ID=&quot;ComboBox1&quot; WIDTH=96 HEIGHT=24
CLASSID=&quot;CLSID:8BD21D30-EC42-11CE-9E0D-00AA006002F3&quot;>

<param name=&quot;VariousPropertyBits&quot; value=&quot;746604571&quot;>
<param name=&quot;BackColor&quot; value=&quot;2147483653&quot;>
<param name=&quot;ForeColor&quot; value=&quot;2147483656&quot;>
<param name=&quot;MaxLength&quot; value=&quot;0&quot;>
<param name=&quot;BorderStyle&quot; value=&quot;0&quot;>
<param name=&quot;ScrollBars&quot; value=&quot;0&quot;>
<param name=&quot;DisplayStyle&quot; value=&quot;3&quot;>
<param name=&quot;MousePointer&quot; value=&quot;0&quot;>
<param name=&quot;Size&quot; value=&quot;2540;635&quot;>
<param name=&quot;PasswordChar&quot; value=&quot;0&quot;>
<param name=&quot;ListWidth&quot; value=&quot;0&quot;>
<param name=&quot;BoundColumn&quot; value=&quot;1&quot;>
<param name=&quot;TextColumn&quot; value=&quot;65535&quot;>
<param name=&quot;ColumnCount&quot; value=&quot;1&quot;>
<param name=&quot;ListRows&quot; value=&quot;8&quot;>
<param name=&quot;cColumnInfo&quot; value=&quot;0&quot;>
<param name=&quot;MatchEntry&quot; value=&quot;1&quot;>
<param name=&quot;ListStyle&quot; value=&quot;0&quot;>
<param name=&quot;ShowDropButtonWhen&quot; value=&quot;2&quot;>
<param name=&quot;ShowListWhen&quot; value=&quot;1&quot;>
<param name=&quot;DropButtonStyle&quot; value=&quot;1&quot;>
<param name=&quot;MultiSelect&quot; value=&quot;0&quot;>
<param name=&quot;Value&quot; value>
<param name=&quot;Caption&quot; value>
<param name=&quot;PicturePosition&quot; value=&quot;458753&quot;>
<param name=&quot;BorderColor&quot; value=&quot;2147483654&quot;>
<param name=&quot;SpecialEffect&quot; value=&quot;2&quot;>
<param name=&quot;Accelerator&quot; value=&quot;0&quot;>
<param name=&quot;GroupName&quot; value>
<param name=&quot;FontName&quot; value=&quot;MS Sans Serif&quot;>
<param name=&quot;FontEffects&quot; value=&quot;1073741824&quot;>
<param name=&quot;FontHeight&quot; value=&quot;165&quot;>
<param name=&quot;FontOffset&quot; value=&quot;0&quot;>
<param name=&quot;FontCharSet&quot; value=&quot;0&quot;>
<param name=&quot;FontPitchAndFamily&quot; value=&quot;2&quot;>
<param name=&quot;ParagraphAlign&quot; value=&quot;1&quot;>
<param name=&quot;FontWeight&quot; value=&quot;400&quot;>

</OBJECT>


I put this in a <form> on an asp page, when I try to add items to the combo box like so:

ComboBox1.additem &quot;Test&quot;

it will not show up on the asp page. When I did some testing in a regular html page and not in the <form> tag it worked great any suggestions. I think I am missing something basic here.....

 
I'm only guessing here, but I think ActiveX controls are client side, so it might work if you put that code in a client-side script rather than server-side.
 
I was having the exact same problem yesterday. Combobox would work outside of the form tag, but not within. I found that when using the control within the form you have to specify the form id when calling the method of the combobox. So... Your modified HTML should look something like this:

<FORM ID=&quot;myForm&quot; Action=&quot;some_action.asp&quot;>
<OBJECT ID=&quot;myComboBox&quot;
WIDTH=150 HEIGHT=24
CLASSID=&quot;CLSID:8BD21D30-EC42-11CE-9E0D-00AA006002F3&quot;>
<param name=...(see above for list)
</OBJECT>
' load the ActiveX control after the window has been loaded
<SCRIPT LANGUAGE=&quot;VBScript&quot;>
<!--
Sub Window_OnLoad()
myForm.myComboBox.AddItem(&quot;some text&quot;)
End Sub
-->

notice that on the 'additem' method call you must also specify the form name so the script can find the object you are referring to....

Enjoy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top