Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Duplicate Items In A Combo Box


I have created a quotes data base wherein i collect data from books, articles, and even articles on the internet. I use 6 different comboboxes, combobox(0) to combobox(5), to fill in the title, author, and keywords. So each time i move from one record to another or add records, i call the following procedure, so as to rewrite each of the text, combo, and richtext boxes on the form. This procedure is called "PopulateRs"

Public Sub PopulateRs(Rs As Recordset, ctlControl As Control, cntIndex As Integer)

Rs.MoveLast
Rs.MoveFirst
Do While Not Rs.EOF
Select Case cntIndex
Case 0
combobox(cntIndex).AddItem Rs!bkart_
Case 1
combobox(cntIndex).AddItem Rs!author
Case 2
combobox(cntIndex).AddItem Rs!ISBN
Case 3
combobox(cntIndex).AddItem Rs!keyword_1
Case 4
combobox(cntIndex).AddItem Rs!keyword_2
Case 5
combobox(cntIndex).AddItem Rs!keyword_3

End Select
Rs.MoveNext
Loop

End Sub


The problem that i am encountering is that i get duplicate items. If for example, i enter the author name of "Lee, Dorothy", the first time this is no problem. The second time when i choose this name from the list, it is duplicated in the list of items. What should i do to correct this problem of duplicate entries?

persub




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Duplicate Items In A Combo Box
Hi,

I have a combo box for which I am adding items to the drop down list with the .additem property.
I am adding items during the running of the application by the user. However, duplicate entries are being added to the combo box if a user selects one of the list items a second or more times.
Does anyone know if there is a way or maybe some code that can stop duplicate entries appearing in the drop down list.

Tanx,
Trigg.

Duplicate Items In Combo Box
hello .. i have a combo box that is load from a database field. what i want to do is when i select an item to display a description in a textbox.. It displays what i want to display fine, but everytime i click on the combo box to selected an item it duplicates the item. I tried the change event but doesn't display anything in the textbox..

Private Sub cboPrice_Click()

If Me.cboPrice.ListIndex = 0 Then
Call showPrice(Me, 1)
Else
Call showPrice(Me, 2)
End If


End Sub

thanx

Datavalidation And Duplicate Items
I have a function that performs a data validation on a combo box change and reports what row the item is found on. The function works great except if I have duplicate names in the field I am searching (Duplicates are unavoidable and required as the next column over gives the description).
I need to always return the correct row that the item is found on. If anyone has any ideas, I would appreciate it.


Code:
Private Function ItemID(ComboBoxToStart, Description, UofMsr)
'ComboBoxToStart = What triggers change, Description = textbox to output description to, UofMsr = Textbox to output to
On Error Resume Next
Dim rw As Integer
Dim tbID As String

For rw = 1 To Sheets("Estimate").Range("C2000").End(xlUp).Row
If Sheets("Estimate").Cells(rw, 3) = ComboBoxToStart.Value Then
Description.Value = Sheets("Estimate").Cells(rw, 5)
'Puts correct Unit of Measure in Caption
UofMsr.Caption = "Qty (" & Sheets("Estimate").Cells(rw, 4) & ")"
tbID0 = Sheets("Estimate").Cells(rw, 4)
Me.tbTypTaxYear0 = Sheets("Estimate").Cells(rw, 14)
fndRW = rw
End If
Next
End Function
Sheet "Estimate" has these columns (Only relevant ones listed):
A = Group
B = Unique ID
C = Item
D = Unit of Measure
E = Description (Notes)

Duplicate Menu Items
Hi,
after some searching i have found nothing so i was wondering if someone could help.

My app has the usual menus File, Edit, Help but it also has a right click menu and i want this to be a combination of the most frequently used buttons on the above menus.

Is there a way to duplicate a menu item so that it appears just as it does along with shortcut in the first menu.

Hope thats kinda clear, thanks,
-Dave

Getting Rid Of Duplicate Items In List Box
Hey , I got a quick question. Im searching a text file in teh last column for items to be listed in my list box. However a lot of these items are the same and I only want each item listed once, how do I do that.

-------------------------------------------------------------------
'And assign a name for the value in each column of the text file
Input #Fnum2, photo, Description, category, subcategory, Station


Select Case Index
Case 0
If Station <> "" Then

(I think I need the code in this area to get rid of duplicates so they do not get listed below. Some of the records have no station number so thats why I put the Station <> "" in there.)

List1.AddItem Station
End If

--------------------------------------------------------------------

Thanks

List Box, Duplicate Items
hello extremists,

i want to write a sub that will remove duplicate items from a list box.

i figured out how not to add duplicates. however i am not sure how to remove duplicate items that already exists in the list.

thank you for all your help,

me

Duplicate Items In Datacombo
hello .. i have a datacombo that is load from a ADO database field.
when i select the datacombo box it will display the duplicate name from the ado database.what i want to do is same item name only display once at the datacombo list.

please help!



VB Code:
Set rsLookup = New ADODB.Recordset    rsLookup.Open "SELECT * From Inventory", cn, adOpenStatic, adLockReadOnly        'Hook the data combo control to both the    'data recordset AND the lookup recordset!    If rs.RecordCount > 0 Then                   With DataCombo1       '---> SET AT DESIGN TIME. <---        '.Style = dbcDropdownList        'The data recordset        Set .DataSource = rs        Set .RowSource = rsLookup       .BoundColumn = "Location"       .DataField = "Location"       .ListField = "Location"              With DataCombo2       Set .DataSource = rs       Set .RowSource = rsLookup      .BoundColumn = "Item Description 1"      .DataField = "Item Description 1"      .ListField = "Item Description 1"               With DataCombo3        Set .DataSource = rs        Set .RowSource = rsLookup        .BoundColumn = "Item Description 2"        .DataField = "Item Description 2"        .ListField = "Item Description 2"             rs.MoveFirst    End With      End With   End With End If

ListView Duplicate Items!
A Form has a TextBox, a ListView & 2 CommandButtons. Assume that the Captions of the 2 CommandButtons are Yes & No. The ListView has 2 Columns.

When text is entered in the TextBox & the Yes CommandButton is clicked, the ListView gets populated in this way (assume that the text in the TextBox is Computer):
Code:
Col1 Col2
----------------
Computer Yes
----------------
Now suppose the user again enters Computer in the TextBox & now clicks the No CommandButton. Since the item Computer already exists in the ListView, I want that instead of Computer again getting added to the ListView, the item should change to
Code:
Col1 Col2
----------------
Computer No
----------------
i.e. the 1st column should remain Computer & only the 2nd column value should change to No. How would I do this?

Thanks,

Arpan

Adding Items Without Duplicate
i want 2 add selections 2 a combobox from a DB. this is my code


Code:
do while adodc1.recordset.eof = false
cmb1.additem adodc1.recordset("field1")
adodc1.recordset.movenext
loop



the problem with this is that occasionally, i have recurring data so my combobox will reflect that

i don't want that 2 happen but i don't know how 2 modify it wihtout using any string arrays 2 store the values and make the checks for recurring strings. i don't want 2 store the values in string arrays as i have lots of data in the DB and 2 cre8 so many variables, my comp will suffer.

is there another way 2 do this?

i tried

Code:
cmb1.additem adodc1.recordsource = "select distinct field1 from" email_table


but this one don't work, or at least i don't know how 2 put it in2 a loop. can neone help?

thx in advance

P.S i m still a very lousy programmer. but i m learning much here

Duplicate Combobox Items
After some help form Tom (Thanks dude) I got some code working pretty good.

I have checkbox that I want to enable a list of items in a combobox below it when the value is true. When the value is false I want the combo list items to dissappear.
I can get the true part to work, but not the false part. I also have a problem with anytime a user checks the box, then unchecks and checks again it adds the items again!
I am pretty sure that is a result of the AddItem function.
How do I get around this??

Snippet of code:

Private Sub ConvScan_Click()
'enable/disable list options

If ConvScan.Value = True Then
    Userform_Initialize
End If

' Conventional Scan options for Pri2 settings
If ConvScan.Value = True Then
    Pri2.Enabled = True
        Else: Pri2.Enabled = False
End If

End Sub

Private Sub Userform_Initialize()
    ConvScanType.AddItem "None"
    ConvScanType.AddItem "No Priority"
    ConvScanType.AddItem "Prioirty Tx Selected"
    ConvScanType.AddItem "Priority Tx Priority 1"
    ConvScanType.AddItem "Priority 1 on Selected"
    ConvScanType.AddItem "Talkback Scan"
End Sub

Thx

Removing Duplicate Items From Listview
Hi, I'm using the code below to remove lines from the Listview if there are duplicate items in the second column. The problem is that there are more than 10,000 items in the second column and the application freezes, CPU goes to 100% and it takes a very long time to finish.

Is there a better/faster way to check the second column for duplicate items?


Code:
Private Sub Command1_Click()
Dim fLITem As ListItem
Dim y As Integer, x As Integer
For y = Listview1.ListItems.Count To 1 Step -1
Set fLITem = Listview1.ListItems(y)
For x = Listview1.ListItems.Count To fLITem.Index + 1 Step -1
If fLITem.SubItems(1) = Listview1.ListItems(x).SubItems(1) Then
Listview1.ListItems.Remove x
End If
Next
Next
End Sub

Removing Duplicate Items From Listview
I'm using the code below to remove lines from the Listview if there are duplicate items in the second column. The problem is that there are more than 10,000 items in the second column and the application freezes, CPU goes to 100% and it takes a very long time to finish.

Is there a better/faster way to check the second column for duplicate items?


VB Code:
Private Sub Command1_Click()Dim fLITem As ListItemDim y As Integer, x As IntegerFor y = Listview1.ListItems.Count To 1 Step -1    Set fLITem = Listview1.ListItems(y)    For x = Listview1.ListItems.Count To fLITem.Index + 1 Step -1        If fLITem.SubItems(1) = Listview1.ListItems(x).SubItems(1) Then            Listview1.ListItems.Remove x        End If    NextNextEnd Sub

Checking A Listbox For Duplicate Items
Alright, I was not sure how to really do this. What I want to do, is run through a listbox and check if there are any duplicate items in the box. As in more then one of the exact same item in the listbox. I know how to run through it and like the basic structure, but the checking has got me stumped.

Removing Duplicate Items From A Listview
this post shows how to remove dupilcatie items form a listbox..

But..anyone know how to remove duplicate items from a listview??

say I have 3 columns in a list view..


how would i remove rows which e.g have duplicate "column 1"s


any idea anyone?


cheers
Abe

Removing Duplicate Items In List
hi all,

I have a list box with a few 1000s items in it.. there are many duplicate items in it.. some several times actaully.

how can I remove all duplicates from the list.

thanks a lot guys!
Abe

ListBox Select Duplicate Items
Hi,
Could someone tell me how to select duplicate items from a listbox and display them to a textbox...
I select the first item and it works ok...but when i select the second name...the same data appears as in the first...but the data is different in the vb database........Please Help!........Thank You........jerrys57

Duplicate Items In Array From Recordset
hi,

i have a pretty long winded set of sql statements that pull different recordsets, match against another recordset. If there are matches, it places the primary keys into an array.

this array is then used to fill a listbox.

the problem that i have is that the array can have duplicate primary keys, therefore putting it twice into my list... i have tried, for each item in the array, looping through the list items. if it matches, do not add it the list, other wise add it. it should then move onto the next array element and do the same.

however, i am getting unusual results!!!

can someone point out the error of my ways please??

many thanks,

jingo_man

here's the code:

cntLoop = 1
Do While cntLoop <= totalMatches
    'SELECTS MATCHING CLIENTS AND ALSO WHERE NOT ALREADY APPLIED FOR JOB
    sqlStrNotApply = "SELECT c.ID,c.FirstName,c.LastName FROM tbl_client c WHERE NOT EXISTS " & _
                     "(SELECT j.jobapplyclientid FROM tbl_job_apply j WHERE c.id = j.jobapplyclientid " & _
                     "AND jobapplyjobid = " & varJobSel & ")" & _
                     "AND id = " & arMatch(cntLoop - 1)
    rsNA.Source = sqlStrNotApply
    rsNA.ActiveConnection = cn
    'On Error Resume Next
    rsNA.Open

    'CHECKS IF RECORDSET IS EMPTY. IF SO, SKIPS ADDING TO LIST
    If (rsNA.BOF And rsNA.EOF) Then GoTo skipThis
    
    'USED TO CHECK RECORDSET AGAINST LIST VALUE
    varListName = rsNA!LastName & ", " & rsNA!FirstName

    'LOOPS THROUGH LIST TO SEE IF ALREADY EXISTS...
' For i = 0 To (frmMatch.lstNotApply.ListCount)
' frmMatch.lstNotApply.ListIndex = (i - 1)
' If frmMatch.lstNotApply.Text = varListName Then
' MsgBox ("There is a match")
' Else
        frmMatch.lstNotApply.AddItem rsNA!LastName & ", " & rsNA!FirstName
        frmMatch.lstNotApply.ItemData(frmMatch.lstNotApply.NewIndex) = rsNA!ID
' End If
' Next i

skipThis:
    rsNA.Close
    cntLoop = cntLoop + 1
Loop

Deleting Duplicate Items From Collection?
how to delete or find out duplicate items from a collection. i mean looking for a fast alogorithm which can do this.. or do you know how to catch the error when a duplicate key is added to a collection?

Function To Find Duplicate Items In ListBox
i heared theres a function to find duplicate items in a listbox...anyone knows it?

tks []

Listbox With Duplicate Items: Cannot Deselect Item
In MS Access 2003 I am developing a nutrition database.
Greetings, this is my first post, comments would be appreciated
In the database I have a table containing a list of foods selected by users.
I display the current user's data in a list box and allow the user to add or remove items at will.
Each item has several fields, all of which are linked to the listbox, some are suppressed by setting columnwidth to 0.
The user may enter the same food several times. During a day's recording, duplicate food entries may have the same or different values (such as quantity) assigned. Quantity is one of the food item's fields.
The listbox's RowSourceType is "Table/Query"; RowSource is a query which returns the current user's data sorted by food name. the SQL code is as follows:
Code:SELECT *
FROM tblCurrentChoices
WHERE UserID=(txtUserID)
ORDER BY Food;
The user may select single items for deletion Listbox.MultiSelect = "None".

The problem:
When there is a single instance of a food item the de-selecting works fine and the listbox correctly displays the remaining items (with no selection highlight, listindex=-1 as expected). But, if there are several instances of a food item (with or without different quantities), selecting one and deleting it always leaves another food item of the same name selected. Closing and reloading the form clears the selection but I don't want to use this 'heavy-handed' technique. As may been seen from the code below I remove the selected item from the table and refresh the listbox.

I have tried
Code:lstbox.selected(index) = False

. . . and . . .
lstbox.listindex = -1
without avail - all my attempts have failed. I have even tried changing the listbox's source to Value list with Null - this clears the listbox. However, when I re-connect it to the original query the listbox is populated correctly but with another food item with the same name highlighted.
Here is a recent sample of a failed attempt:
Code:If lstCurrent.ListIndex >= 0 Then
    'clear selected row
    mySQL = "DELETE tblCurrentChoices.* FROM tblCurrentChoices "
    mySQL = mySQL & "WHERE ID = " & lstCurrent.Column(0) & ";"
    DoCmd.SetWarnings pubHideWarnings 'Disable Warning
    DoCmd.RunSQL (mySQL)
    DoCmd.SetWarnings True 'Enable Warnings
    'deselect items
    Me.Refresh
    'force deselection of remaing items (occurs with duplicate food names)
    If lstCurrent.ListIndex >= 0 Then
        OldRowSourceType = lstCurrent.RowSourceType
        OldRowSource = lstCurrent.RowSource
        lstCurrent.RowSourceType = "Value List"
        lstCurrent.RowSource = ""
        Me.Refresh
        lstCurrent.RowSourceType = OldRowSourceType
        lstCurrent.RowSource = OldRowSource
        'another selection occurred automatically (food duplicates)
        tmp = lstCurrent.ListIndex
        lstCurrent.Selected(tmp) = False 'deselect current item
    End If
    Me.Refresh
Else

This code contains two attempts to solve the problem. How does the listindex property become reset (it must be remembered somewhere)?

More importantly - Can anyone help my to solve this annoying problem?

Duplicate Values In Combo Box ...
Dear Friends,

In the MS Access database table ("Customers") there are just only 2 Customers added. But when I try to fill it in the Combo1 list using the following code it shows duplicate values in the combo1 list. How can I prevent it adding the duplicate values (Customers) in the list? I am calling (Call Fill_Fields) it in a Form_Load event.


Code:
Public Sub Fill_Fields()

If rs.State = adStateOpen Then
rs.Close
End If

rs.Open "Select DISTINCT CustomerName from Customers Order By CustomerName", db, adOpenDynamic, adLockOptimistic

Do While Not rs.EOF
Combo1.AddItem rs.Fields("Cn")
rs.MoveNext
Loop

rs.Close
Set rs = Nothing

End Sub


Thanks in advance.

vblearner6

Removing Duplicate Entries From Combo Box
Say I have this code:


Code:
Private Sub comboTerritories_Click()
txtTerritories.Text = txtTerritories.Text & comboTerritories.Text & vbNewLine
Territory = Territory & comboTerritories.Text
End Sub

How would I prevent/cover up the user clicking the same option twice, thus creating duplicated items?

Thanks.

How Can I Prevent Duplicate Entry In A Combo Box?
Hello All,
I was wondering if someone could tell me how to prevent duplicate entries in a combo box. I used to know how to do this, but it's been a couple years since I messed with vb6, so I forget.

For instance, I have a form with a combo box that the end user can use to add names to. My problem is that if the end user enters a name that is already there, it will put it in again. I want to prevent that and display a message saying that it is already there. Here is my code for the Command button to enter entry:
VB Code:
Private Sub Command1_Click()cboPlayers.AddItem cboPlayers.TextOpen "c:Documents and settingsDavedesktopcomboPlayers.txt" For Append As #1 'opens Players.txtOpen "c:documents and settingsdavedesktopcombo" & cboPlayers.Text & ".txt" For Output As #2 'opens or creates "the name of the player".txtPrint #1, cboPlayers.Text 'Writes the contents of the Combo box's text field to Players.text  Since previous line was Open For Append, it will add to the end of test.txtClose 'Closes all open filescboPlayers.Text = ""End Sub
Thanks You!

How To Eliminate Duplicate Entries In Combo Box?
hi there! I'm a newbie here! I jst wonder if anyone here knows how to eliminate duplicate entries? The instance is I have several tables consisting of fields for activity, resource and resource driver. Given that some activity uses two resource drivers. What happens is that when I add an activity that uses two resource drivers, the result is that the activity also duplicates. Hope someone can help me! Thanks!

Heres' the code:

Private Sub Combo0_AfterUpdate()

If Me.AllowEdits = True Then
Dim ActAdded As String


If Not Acty = DelTag + CStr(Me.CurrentRecord) Then
'store DrvCode from Driver table to
'DrvCode field of hosted table
Me![ActCode] = Combo0
If IsNull(Combo0) Or (Combo0 = "") Then
ActAdded = DelTag
Else
If Combo0 = Acty Then
strg = "Delete * From ChangeATable "
strg = strg + "Where (((ChangeATable.BRUCode)='" + BRUCont + "') And "
strg = strg + "((ChangeATable.OldActCode)='" + Acty + "'));"
DoCmd.RunSQL (strg)
Exit Sub
Else
ActAdded = Combo0
End If
End If
Else
ActAdded = Combo0
End If

'update NewActCode of ChangeATable for the chosen record
strg = "Update ChangeATable Set ChangeATable.NewActCode='"
strg = strg + Combo0 + "' "
strg = strg + "Where (((ChangeATable.BRUCode)='" + BRUCont + "') And "
strg = strg + "((ChangeATable.OldActCode)='" + Acty + "'));"
DoCmd.RunSQL (strg)
End If

End Sub

Removing Duplicate Results For A Combo Box
I want a combo box drop-down to display items from a particular column of a table, but the particular column in use has a relatively high chance of producing duplicates. Is it possible for the combo box to either not display the duplicate results, or for the query to only display a single instance of each result that would be duplicated?

ie, I want a menu that would show this...

a, a, a, a, a, a, b, c, d, d, e, f, f, f, f, f, f, f, j, k

to instead show

a, b, c, d, e, f, j, k

any suggestions?

Removing Duplicate Entries From Listbox/combo Box
All,

Does anyone know how to query a list/combo box and remove any duplicate entires.

TIA

Drum on .. .. . . .

Taking Duplicate Entries From Combo Boxes.
Hey, i'm new to vbCity so hello everybody! I am not exactly what you would call a skilled VBer! In fact i'm totally rubbish at it! I am writing a program that adds addresses to a text file and then can recall the data back when it is searched for, i.e if a phone number is recognised, all the data for that number is recalled. All the street names enclosed in the entire file are added to a combo box. My problem is that by use of as simple code as possible, i want it so that there cannot be two duplicate roads, i.e. if the file has two records for the same street then i only want the street to be displayed once!

Your quick correspondance is appreciated, and i thank you in advance
Mike Smith

Resolved - Saving Modified File Gives Duplicate Entry In Combo Box
I have a combo box and rtb on my form. When an item is chosen in the combo box, the associated file is opened in the rtb. If I alter the file and then save I want to be able to just save the altered file under the same name in the combo box. The problem I have had it that if I loop through the list in the combo box I either get two entries in the combo list with the same name and two files with the same name, but one of them is the modified one, or my error handling won't let me save it as I have a message box saying "File name already Exists" and exits sub.


VB Code:
For ctr = 0 To cmbCode(SSTab1.Tab).ListCount - 1             If cmbCode(SSTab1.Tab).List(ctr) = cmbCode(SSTab1.Tab).Text Then             msgbox "File name already exists"             Exit Sub             End IfNext ctr

I just want to be able to save the modified file under the same combo text item and in the same file.
Hope this makes sense

aikidokid

Combo Box Add Items
I use database. I have field name "username". It contains 3 records "User1","user2" and "user3" .

I don't want "user3" were added into combo box. How I can do that?
I use code below but it add 3 user into the combo box.


Code:
adoRS.Open "SELECT * FROM pass order by id", adoConn, adOpenDynamic, adLockOptimistic
Do Until adoRS.EOF
Changepass.Combo1.AddItem adoRS.Fields("username").Value
adoRS.MoveNext
Loop

Items In A Combo Box
ok so basically heres my problem

i have an empty text box, text1.text

and a combo box

when u click the combo box it will drop down^
1
2
3
4
5
and when you click 1 i want it to appear in the text box saying:
"you have just clicked 1"

and if you click 2 i want it to say:

"you have just clicked 2"

but i dont no what the code is for actions in a combo box.

can some1 please help me!



dunno if i explained this very good:S

How To ADD ITEMS To COMBO BOX...
Hello there, VB Experts! Now I have some serious tough questions here...

How do you READ values from a file then add it into a combo box?
For EXAMPLE a file called "fonts.cmd" the value:
Arial
Fatity

Tahoma
Reci

Suicide

------------------ As you see there are spaces between the values, how do I put those values into a COMBO BOX? So, I can select the values in the COMBO BOX.



And what does vbCrLf do?
How do I use vbCrLf?

How To Add Items In Combo Box
Okay, the Title isn't specific enough but I will specify myself here.

I am making this program (well I already made it... Finished) Anyways It has a Combo box with all content and stuff, then when you click on it it will bring up texts and stuff in a text box! What I'm wondering is, if you save a File that you have edited in that txtBox(textbox) and add that file in the cboBox(combobox) so when the user clicks on that cbobox the content of that file appears in the text box. I know the Command cboBox.Additem (Whatever) but you see, when you unload the Program, that item will be gone.... and forever lost, I want it to be there permanently, forever...... How can I do this, Can anyone show me an example code?

Thanxx!

Combo Box Items
I am a VB newb and need some help.

I am just trying to create a few simple combo boxes that just show a list of data that will not change.
Over time the results selected I may use to execute other things but for now they are just for visual representation.

The code I have started works fine, but everytime I click the pull down box it keeps adding the same items over and over!!!
I want to avoid using a form and just leave it embeded withing Excel.

My code:
Private Sub Box1_change()
box1.AddItem "None"
box1.AddItem "Tx on Selected"
End Sub

Thanks

Combo Box Items
Hi everyone... I have a form on which I placed a combo box. I have coded my form so that if my user starts typing their name into the combo box's text area, it auto completes. If I have Joe and Joanne both in my list, and my user starts typing "Jo, the auto complete feature will have selected Joanne, but the next character typed is "s" (name is Joseph), how do I compare the text value with the items in the list? I thought Combo1.Item, but Item is not an available property for a combo box. So what would it be?
Code:If NOT Combo1.Text = Combo1.??? then

Happieman
a.k.a. Bill

Edited by - Happieman on 10/31/2007 12:50:28 AM

Load Combo Items From An Ini?
Hi,

I'm not sure if I'm posting this in the right place

I'm already using an ini to save the settings in my application, so is it possible to use the ini file to load my combo box items?

Maybe the KeySection could be called COMBO and then list the items... I'm not sure how to do this, or even if it's possible.

Could anyone tell me if it's possible, and if so how?

Thanks a lot, much appreciated!

Deleting Items From A Combo Box
Hi everyone, I'm pretty new to VBA so this might be silly. I have a combo box that is unbound. I add the items by reading the subdirectories in my app directory, so I'm using cbo.AddItem, how do I delete them so when I add them again I don't have repeated values? I'm used to using cbo.Clear in VB, but I don't have that property in VBA.
Thanks!

Adding Items Into A Combo Box With For/Next
Newbie problem, any help is greatly appreciated!!!

Here's what I have. I am writing a program that maintains reports for the volunteer firestation in my town. Each "User" of this program has their data stored in it's own file. (IE: If the UserID was 201 then their profile path is "App.path & "datauserinfo" & UserID & ".pfd"" making in my case the path: c:pauldenvfduserinfo201.pfd).

I am trying to use a for next loop (XasRadioLoads) to open these files one by one to get that data from them to fill in a combobox. I only have 2 users of a possible 20 configured at this point. What the loop is doing is adding 10 each of my 2 users filling up 20 spaces instead of just 2. Here is the code I am using.
---------------

On Error Resume Next
UserToVerify = 201

For XasRadioLoads = 1 To 20
Open App.Path & "datauserinfo" & UserToVerify & ".pfd" For Input As #1
Input #1, UserRadioID, UserLastName, UserFirstName, UserMI, UserAddress, UserCity, UserState, UserZIP, UserPhone, UserCellPager, UserGrantAccess, UserPassword
Close #1

combo_IC.AddItem UserRadioID & " - " & UserLastName & ", " & UserFirstName
combo_IC.Refresh
UserToVerify = UserToVerify + 1
Next XasRadioLoads

--------------------

Can anyone help me with this? THANKS A LOT!!!

Dynamic Combo Items
hi,

I need to load combo box values dynamically from a external text file

The external text file will contain 2 pieces of information DisplayName & Path seperated by a tab

App1 C:TestApp1.exe
App2 C: est2App2.exe and so on

I am trying to build a small interface that has a combo box and a Launch App button. The combo box will contain all the Diaplay Names from the external textfile and when the launch App button is clicked i use shell and call the relevant path of that combo item.

Can someone give me an idea of how this can be done?.

Removing All The Items In Combo
Hello
I added values from 1 to 50 to combo:

For x = 1 to 50

Combo.AddItem x

Next x


But when an event is triggered I want to remove these values:

For x = 1 to 50

Combo.RemoveItem x

Next x

This does not work, how should I remove all the values?

How To Only Add Unique Items To A Combo Box.
Im making an Internet Explorer knock-off for my programming class. I am using a combobox for the address bar, so I can add sites visited into it. I only want to add unique addresses though. As of now, it adds the same addresses several times.

Any help?

Disable Combo Box Items
Is it possible to disable individual items in a combo box, if not is it possible to change the forecolor of individual items so as I can disable them through code?
Thanks for any help

Remove Combo Items
i need to remove items in a combo box that already exist in the list but im not sure how. i thought this code i wrote last night would work, but it doesnt, and i cant figure out why. any ideas?



Code:
For b = 1 To cboRecent.ListCount
'c is the array index
c = b - 1
'd is a value linked to c array index
d = cboRecent.List(c)
'nested for to find a match between d & the other items
For e = 1 To cboRecent.ListCount
f = e - 1
If cboRecent.List(f) <> d Then
'add item to list
cboRecent.AddItem (RECENTLIST)
End If
Next e
Next b

COMBO: Selecting Items
the combo is populated with


Code:
cmbWC.AddItem Format(refWC.wc & " " & refWC.desc, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")

where refwc.wc is up to 6 characters and refwc.desc is up to 20 chars.

and i want to be able to have an item selected based on refwc.wc.

help.

Assigning To Items In A Combo Box
I have a combo box in my new program, never used one before, but I managed to put 4 items into a list

each item needs a value though, heres an example of what I got:

combo1
Item1
Item2
Item3
Item4

each item in it needs a value as I said, how do I go about getting them in?

Switching Items In Combo Box
Good Afternoon All.
I am trying to code a "Select" function in my application that will allow the user to select items by Product ID or by Product Description.
The main form has a combo box set up that currently displays the Product description Information.
I am struggling to work out how to code my menu items "Select > by Product ID" so that it changes this combo box to display the Prodict ID's from the tbl, and also fill the text boxes with the appropriate information.
"Select > by Product Description" should change the combo box to display the product description info etc.

I have attached the current project so that hopefully seeing how I currently have everything set up will make it easier for you to assist me.
I am working in Visual Studio 2005.

Many Many thanks in advance.

Edit by Shurik12:
Please no binaries in attachments

Adding Items To Combo
Is there a way where I can read from a file and add each line of the file to a combo control?

Loading Items Into A Combo Box From TXT
Hey,
I have a combo box, also have a txt file containing a username and other data, I want to load the first value (delimited by "~") into the compbo box.
the first bit of data will be the username...
I know how to open and read the file, but not how to get the first value into the combo box in a list form
and then when something from the list is selected but the corresponding data into the fields. Hope that makes sence, If you could point me in the right direction that would be great!
Thanks

Load Combo Box Items Once
I've got a list of around 5000 share codes that I display in a combo box which the user selects 1. As there are around 5000 items to add it takes 3/4 seconds for them all to load and it looks like my app has frozen...

My question...is it possible to load all the items into a combobox when my app loads (I have a splash screen) and then display that combo box which already has the share codes added when I load any form that needs to display the list?

Hope that makes sence.

Need=&gt;comparing Items From Combo Box
sample codes could be a great help..tnx

Copyright © 2005-08 www.BigResource.com, All rights reserved