I am trying to change a value in an array when the user selects a name a from a list or combo box. Also, I want the highlighted item to be displayed in a Label for the current selection. After all the names are selected from the boxes than I going to write those to a file or table. It sounds real simple and it probably is, but I am having a brain fart.
lblName - label
lstName - name of listbox
arrName (1, lstName) - array to hold item for list box
Thank you.
7 1366
I would suggest uding a combo box with its style property set to "Simple Combo giving you a combo box with a listbox look and in the coding of the combo box on its click event use the following
Label1.Caption = combobox(index).text
Index Refering to the array number of the Combo box
I am trying to change a value in an array when the user selects a name a from a list or combo box. Also, I want the highlighted item to be displayed in a Label for the current selection. After all the names are selected from the boxes than I going to write those to a file or table. It sounds real simple and it probably is, but I am having a brain fart.
lblName - label
lstName - name of listbox
arrName (1, lstName) - array to hold item for list box
Thank you.
Declare an integer (dim i as integer) and an array of strings (dim Arr1() as string) in the general declarations.
In the Change event of the listbox there should be something like this: - i=i+1
-
redim preserve arr1(1 to i)
-
arr1(i) = listbox1.list(listbox1.listindex)
-
label1.caption = listbox1.list(listbox1.listindex)
now you have all the selected items in the array
HTH
lblCurrentPlayer.Caption = cmbPlayer(Index).Text
I still get an error. I have tried that syntax before, but I still don't think I am referencing the right part of the combo box. Does the cmbPlayer(Index).Text refer to the selected item from the combo box?
lblCurrentPlayer.Caption = cmbPlayer(Index).Text
I still get an error. I have tried that syntax before, but I still don't think I am referencing the right part of the combo box. Does the cmbPlayer(Index).Text refer to the selected item from the combo box?
indexes are from 0 to the elements in the list box - 1
listbox1.listindex will return the hightlighted index, so if you use
lblcurrentplayer.caption = cmbplayer.list(cmbplayer.listindex)
will do
also works for combo boxes
I've walked away from this, and I am trying this again. I still can only display the number from the combobox of the listindex.
Ex. Combo box has (mike, jim, alex, and pete). When I select Alex it is displayed by the listindex of 2. I want to show the name alex, and then store this in an array.
I cannot refereence cmbbox.list.(cmbbox.listindex) because my version of VBA doesn't have a .list property. Access 2000
I've walked away from this, and I am trying this again. I still can only display the number from the combobox of the listindex.
Ex. Combo box has (mike, jim, alex, and pete). When I select Alex it is displayed by the listindex of 2. I want to show the name alex, and then store this in an array.
I cannot refereence cmbbox.list.(cmbbox.listindex) because my version of VBA doesn't have a .list property. Access 2000
I dont know why is this, i dont have access here to check it out, but in the while:
Since you're using a combobox, when you select something its showed as the combobox text. so you can store that by writing in the change procedure something like: - i=i+1
-
redim preserve myArry(1 to i)
-
myarr(i) = combobox1.text
-
msgbox combobox1.text
Just make sure that the combobox matchrequired property is true.
HTH
Thanks everyone for your input. I figured it out. I went to the control source feature in Access and put in this code to reference it to a text box. As soon as I had the value linked to the textbox everything else is easy.
=[cmbPlayer].[column](1)
I haven't done much programming the last 5 years, it is amazing how you forget little steps. Thanks again.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Allan Horwitz |
last post by:
When I try to reference the lstproducts.selecteditem.value using
autopostback from the lstproducts listbox I get an error? How can I
fix my code to get the selected value from the lstproducts...
|
by: 00_ChInkPoIntD12 |
last post by:
Can anyone confirm there isn't a Sort() method for WebControl Listbox in
Asp.net?
It is rather simple to write a method to do the sorting, but just wondering
I shouldn't invent the wheel if...
|
by: George |
last post by:
Sub ExcelToListBox()
Dim xRange As Object
Dim ary
Dim xValue As String
xRange = oXL.Range("A1:A9") 'has letters A-H
ary = xRange.value
xValue = ary(3, 1) 'xValue = C...
|
by: Zorpiedoman |
last post by:
The problem is this:
I have a list box. I set an array list as the datasource. I remove an item
from the array list. I set the listbox datasource to nothing. I set the
listbox datasource to...
|
by: Paul_Madden via DotNetMonster.com |
last post by:
Basically I have a listbox to which I add simple STRING items- I have a
progress bar which I increment whenever I populate another portion of the
complete set of items I wish to add. What I observe...
|
by: Paul |
last post by:
Hi All,
Framework 1.1 listbox control unable to DataBind
I've been googling for an answer to this query that appears quite a lot, but
none, it seem, answers my problem directly.
I am...
|
by: crespo |
last post by:
hi,everyone.
I have a question about using listbox in a customized user control.I use
a listbox directly in a asp.net page and it works very well,but when I use
the same code in a user...
|
by: Sunray |
last post by:
I have a form called the sales form and i have 2 sets of listboxes
So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
|
by: Sweetiecakes |
last post by:
Hi
I have an string array containing file paths. I have added them to a
ListBox with AddRange();
When I delete an item from the ListBox, how can I delete the same item
from the original...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |