Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 650959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:06:36+00:00 2026-05-13T22:06:36+00:00

I’ve created a custom user control that has several properties. One specifies which database

  • 0

I’ve created a custom user control that has several properties. One specifies which database I want the control to access. I want to be able to present the user of the control a drop down from which he can select which database the control will interact with.

How do I get the dropdown to work? I can get default values, but have yet to figure out how to get the selectable list.

Any help is apprectiated.

Thanks.

Marshall

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:06:37+00:00Added an answer on May 13, 2026 at 10:06 pm

    Here is the template I use to create a custom datasource for my comboboxes:

        Private Class Listing
    
        Private _List As New ArrayList
    
        Public Sub Add(ByVal ItemNumber As Integer, ByVal ItemName As String)
    
            _List.Add(New dataItem(ItemNumber, ItemName))
    
        End Sub
    
        Public ReadOnly Property List() As ArrayList
            Get
                Return _List
            End Get
        End Property
    
    End Class
    
    Private Class dataItem
        Private _ItemNumber As Integer
        Private _ItemName As String
    
        Public Sub New(ByVal intItemNumber As Integer, ByVal strItemName As String)
            Me._ItemNumber = intItemNumber
            Me._ItemName = strItemName
        End Sub
    
        Public ReadOnly Property ItemName() As String
            Get
                Return _ItemName
            End Get
        End Property
    
        Public ReadOnly Property ItemNumber() As Integer
            Get
                Return _ItemNumber
            End Get
        End Property
    
        Public ReadOnly Property DisplayValue() As String
    
            Get
                Return CStr(Me._ItemNumber).Trim & " - " & _ItemName.Trim
            End Get
    
        End Property
    
        Public Overrides Function ToString() As String
    
            Return CStr(Me._ItemNumber).Trim & " - " & _ItemName.Trim
    
        End Function
    
    End Class
    

    And this is how I load it:

        ListBindSource = New Listing
    
        Me.BindingSource.MoveFirst()
        For Each Row As DataRowView In Me.BindingSource.List
            Dim strName As String = String.Empty
            Dim intPos As Integer = Me.BindingSource.Find("Number", Row("Number"))
            If intPos > -1 Then
                Me.BindingSource.Position = intPos
                strName = Me.BindingSource.Current("Name")
            End If
            ListBindSource.Add(Row("Number"), strName)
        Next
    
        cboNumber.DataSource = ListBindSource.POList
        cboNumber.DisplayMember = "DisplayValue"
        cboNumber.ValueMember = "Number"
        AddHandler cboNumber.SelectedIndexChanged, AddressOf _
                cboNumber_SelectedIndexChanged
    

    Hope this helps. One thing to keep in mind is that if cboNumber has a handler already assigned to the SelectedIndexchanged event, you will encounter problems. So don’t create a default event.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.