Help, Populating dropdowns via subroutine

P

Paul D. Fox

I'd like to populate four dropdowns using code behind. Each dropdown contains the same list. How can I populate them using a subroutine. Something like:

InitializeDropDownList(ddlQuadrant1) 'Where ddlQuadrant1 is the first dropdown
InitializeDropDownList(ddlQuadrant2) 'Where ddlQuadrant2 is the second dropdown
InitializeDropDownList(ddlQuadrant3) 'Where ddlQuadrant3 is the third dropdown
InitializeDropDownList(ddlQuadrant4) 'Where ddlQuadrant4 is the fourth dropdown
Which calls something like this:

Private Sub InitializeDropDownList(ByVal ctlDropDownList As DropDownList)

ctlDropDownList.Items.Insert("", "")
ctlDropDownList.Items.Insert("Application/Credit", "Application/Credit")
ctlDropDownList.Items.Insert("Note Features", "Note Features")
ctlDropDownList.Items.Insert("Regency", "Regency")
ctlDropDownList.Items.Insert("ARM Info", "ARM Info")
ctlDropDownList.Items.Insert("Pay History", "Pay History")
ctlDropDownList.Items.Insert("Property", "Property")
ctlDropDownList.Items.Insert("Valuation Comments", "Valuation Comments")
ctlDropDownList.Items.Insert("Diligence Comments", "Diligence Comments")
ctlDropDownList.Items.Insert("Compliance", "Compliance")

End Sub
 
P

Paul D. Fox

Nevermind, I figured out my issue, the first parameter in the "Items.Insert" needs a sequence number (e.g. 0 for first item, 1 for second item, and so on)
I'd like to populate four dropdowns using code behind. Each dropdown contains the same list. How can I populate them using a subroutine. Something like:

InitializeDropDownList(ddlQuadrant1) 'Where ddlQuadrant1 is the first dropdown
InitializeDropDownList(ddlQuadrant2) 'Where ddlQuadrant2 is the second dropdown
InitializeDropDownList(ddlQuadrant3) 'Where ddlQuadrant3 is the third dropdown
InitializeDropDownList(ddlQuadrant4) 'Where ddlQuadrant4 is the fourth dropdown
Which calls something like this:

Private Sub InitializeDropDownList(ByVal ctlDropDownList As DropDownList)

ctlDropDownList.Items.Insert("", "")
ctlDropDownList.Items.Insert("Application/Credit", "Application/Credit")
ctlDropDownList.Items.Insert("Note Features", "Note Features")
ctlDropDownList.Items.Insert("Regency", "Regency")
ctlDropDownList.Items.Insert("ARM Info", "ARM Info")
ctlDropDownList.Items.Insert("Pay History", "Pay History")
ctlDropDownList.Items.Insert("Property", "Property")
ctlDropDownList.Items.Insert("Valuation Comments", "Valuation Comments")
ctlDropDownList.Items.Insert("Diligence Comments", "Diligence Comments")
ctlDropDownList.Items.Insert("Compliance", "Compliance")

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,206
Latest member
SybilSchil

Latest Threads

Top