Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Populate Combo box

Posted on 2014-10-09
3
Medium Priority
?
99 Views
Last Modified: 2014-10-10
HI Experts
I have 2 dimesional array

  Public fee_str(3, 2) As String
I wuould like to display in a combobox and store the selected rows second column value to arx
please help
0
Comment
Question by:b001
3 Comments
 
LVL 3

Accepted Solution

by:
jcrozier21 earned 2000 total points
ID: 40371808
'populate
dim i as integer
i=0
do while i < 3
combo.AddItem fee_str(i,0) & ";" & fee_str(i,1)
i=i+1
loop

Open in new window


dim secondColumnValue as string
secondColumnValue = combo.column(1)

Open in new window

0
 
LVL 12

Expert Comment

by:jkaios
ID: 40371896
To display contents of array in combo box (assuming the combo box is named Combo1):

Dim ii as Integer, jj as Integer
For ii = 0 to 3
   For jj = 0 to 2
     Combo1.AddItem fee_str(ii,jj)
   Next
Next

Open in new window


To display selected item in combo box:

Private Sub Combo1_Click()
   Debug.Print "selected item: " & Combo1.Text
   Debug.Print "selected item: " & Combo1.List(combo1.ListIndex)  'same as above
End Sub

Open in new window

0
 

Author Comment

by:b001
ID: 40372710
i have error

Error      1      'AddItem' is not a member of 'System.Windows.Forms.ComboBox'
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question