Sub GO()
'Create the ASPPrinter object
Set Prn=CreateObject("ASPPrinterCOM.ASPPrinter")
'Call the GetPrinters method
Printers=Prn.GetPrinters(PrintersCount)
'P = PrintersCount & " printers were detected on your system:"
For i=0 To Ubound(Printers)
dim opt
opt=document.createElement("option")
' Add an Option object to Drop Down/List Box
opt.text = Printers(i)
'MsgBox "OPTION"&opt.text
opt.value = Printers(i)
document.getElementById"DropDownList1").options.add(opt)
'Assign text and value to Option object
Next
Set Prn=Nothing
End Sub
You're Browsing As A Guest! Register Now... |
||
|
Become a ASP.NET Expert!
Join 416,721 ASP.NET Programmers for FREE! Get instant access to thousands
of ASP.NET experts, tutorials, code snippets, and more! There are 2,891 people online right now.Registration is fast and FREE... Join Now!
|
||
Page 1 of 1
How to add items to ASP.NET DropDown List through client side VBSCRIPT I tried out the code but i am not able to add option text.
#1
How to add items to ASP.NET DropDown List through client side VBSCRIPT
Posted 14 May 2008 - 10:49 PM
#3
Re: How to add items to ASP.NET DropDown List through client side VBSCRIPT
Posted 22 May 2008 - 07:45 AM
This looks good except for the typo:
I have VS 2008 and it seems that the line would work like this:
But I would try to build a string of printer names, and display them to the screen first, just to make sure that they are really there.
document.getElementById"DropDownList1").options.add(opt)
'should be
document.getElementById("DropDownList1").options.add(opt)
I have VS 2008 and it seems that the line would work like this:
Sub GO()
'Create the ASPPrinter object
Set Prn=CreateObject("ASPPrinterCOM.ASPPrinter")
'Call the GetPrinters method
Printers=Prn.GetPrinters(PrintersCount)
'P = PrintersCount & " printers were detected on your system:"
For i=0 To Ubound(Printers)
document.getElementById("DropDownList1").Items.Add(Printers(i))
Next
Set Prn=Nothing
End Sub
But I would try to build a string of printer names, and display them to the screen first, just to make sure that they are really there.
Page 1 of 1


Ask A New Question
Reply





MultiQuote






|