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
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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?
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.
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?
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
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?
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
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.
Combo Box...disabling Items
is there a way i can disable items in a combo box once they have been selected.
I know you can remove them but this messes with the listindex values?
i had been removing them all along but it wont work as it changes the value of the string im assigning to it.
heres what i had:
If cboLocation.ListIndex = 0 Then
stLocation = "GCS1"
cboLocation.RemoveItem (itemIndex)
ElseIf cboLocation.ListIndex = 1 Then
stLocation = "GCS2"
cboLocation.RemoveItem (itemIndex)
ElseIf cboLocation.ListIndex = 2 Then
stLocation = "GCS3"
cboLocation.RemoveItem (itemIndex)
ElseIf cboLocation.ListIndex = 3 Then
stLocation = "GCS4"
cboLocation.RemoveItem (itemIndex)
ElseIf cboLocation.ListIndex = 4 Then
stLocation = "GCS5"
cboLocation.RemoveItem (itemIndex)
etc etc
Adding Items To Combo Box
Hi,
are there any way (code or other special control) which makes the Combo box control able to add new items during Runtime if this item is not in the combo box list, complete the text if the first letters typed in the combo Box are included in one of the list and so on ...
may any code can do it.... pleaase prode me with the code.
Thanx
Adding Items To Combo
How would I insert more text into the combo, that way when i click the / button, it'll have more choices instead of just the header
Can Items Within A Combo Box Expand?
Good afternoon!
I'm making a fairly simple database with Access 97 and VB6. One of the combo boxes in the database lets you select an e-mail program from a list. Right now I have
"Outlook"
"Outlook Express"
"Netscape Mail"
etc
What I would like to be able to do though, is when I put my mouse on "Outlook", for example, then a new menu opens up right next to it with a list of versions to choose from. So it would be like
"Outlook" -> "97"
"2000"
"2002"
etc.
Things like that are easy to do with the Menu Editor, but can a simple combo box expand like that? or would I have to make my own activex control?
here's an example of what I mean by an expanding menu. ^_^
thanks!
How Can I Sort Items In Combo Box
I Would like to display the items sorted i.e whenever I press any key it will bring the items matching the letter.
I mean it will work as index of MSDN help.
I need urgent help
Add Items To Combo Box In Word Doc
I am setting up a template for staff to use & find that the basic word forms combo boxes are too limited, so I am trying to learn how to add an ActiveX combo box instead. I know how to go into Word 2000, drag a combo box from the control toolbar onto the template where I want it to be located & then go into the coding area - but I am not finding the right code to add items so that they list correctly. After the sub combobox1_change() line I use the additem method, but find that if I don't add the right items the first time, the list either repeats or holds old values when I go in to change items later or keeps adding values as they are selected each time.... There are about 5 fields out of about 25 that I need these combo boxes for on the template, the rest can just be filled in by the worker. I am not using a userform, just adding the box to the template - is there a better way to try to do this?
How To Save Items In A Combo Box
Alright, here is my predicamint... I have a a combo box, and i want to save items to a file. Lets say it has 4 itmems in it, but it could have more or less at any given time... (the combo box name is cmbgoods)
Here is how the save so far is set up:
VB Code:
Private Sub mnuSave_Click()' this routine saves the game to disk. ' set up the CommDialog controlOptions.CommonDialog1.DialogTitle = "Save Game As" Options.CommonDialog1.FileName = "SaveGame.tsv" Options.CommonDialog1.DefaultExt = "tsv" Options.CommonDialog1.Filter = "Saved Games (*.tsv)|*.tsv|All Files (*.*)|*.*" Options.CommonDialog1.ShowSave lFileName$ = Options.CommonDialog1.FileName If InStr(lFileName$, "") = 0 Then Exit Sub Open lFileName$ For Output As #1' output a headerWrite #1, Char.Name & " Saved Game"' write out the character statsWrite #1, Char.Name' write out the itmesWrite #1, 'What goes he so it would save all the items in the combo box End Sub
If you need any other info that would help you out, just reply. Thx
~$uper-$tar
Adding Items To Combo
I would like to add some items in a combo box
I have the list in a string
E.G.
mystring ="a|b|c|d"
each item separated by "|"
Is there a way using a single call to a method in combo I can add this string to combo rather than calling addItem method in a for loop . This is because I have a lot of items to be added and it takes a considerable amount of time to loop through and add each items.
Currently I am using this method
Dim arrValue
arrValue = split(mystring,"|)
For intIdx = 0 To UBound(arrValue )
cmbValue.AddItem arrValue(intIdx)
next
But cmbValue.AddItem (mystring ) doesnt work.
Thanks in advance
Make Some Of The Items Look Different In A Combo Box
Hi friends,
I have a combo box called LstSalesReps.
I have five items in it
1)Allan
2)Steve
3)John
4)Dave
5)Tim
The SalesReps Dave and Tim are not active now but i do NOT want to remove them from the combo box.
I want to show the SalesReps Dave and Tim in different color or different font or anything of that sort which differentiates Dave and Tim from the rest of them in the combo box.
Hope you understand my question.
Please reply soon.
Thanks,
Srini
Bold Items In A Combo Box
Hey,
I know it's possible to make all the items in a combo box bold, but is it possible to make only some as bold?
thanx
Adding Items To Combo Box
Hai
I'm doing a simple proj. in that i wish to add items to combo box at runtime.
when i'm typing an item into the text area of the combobox at runtime and pressing add button, it was accepting that new item. The problem is when I closed that form or project, the new items i entered are no more visible in the combo box.
Plz help me.
kiran chand
How To Disable Certain Items Of Combo Box In Vb?
Sometimes, based on requirements from users, we like to disable certain items of combo box. It seems VB doesn't provide support for such thing directly. How can I do that? Thanks for your inputs.
Sorting Items In A Combo Box
What is the easiest way to do this? I could always run a sort routine but I thought maybe there was a specific property value. I'm also needing to do this in CDO, Outlook97 on a form.
Combo Box Items Not Visible In Userform
Hi
I've got a combo box with 2 colums.
column1 is 0 pt and column 2 is 125 pt
I fill then with item I get from a database. (how to do that i asked earlier. see post combobox and database).
Filling the combo box ísn't a problem anymore but in my userform I don't see the value of the items only an empry row. When I select an empty row and click on button the has the code MSGBOX me.combobox1 it shows me whats the value of the "empty" row. The forecolor and the backcolor of the combo box aren't the seem
How is this possible.
Raymond
Load Combo Items From Access Db
hi
i have aform in visual basic with acombo box on it
now this is what i want to do but i dont know how
i want the combo box to get items from atable in an access database when the form loads
say instead of the combo1.additem "blabla"
i want this to happen by collecting them from a one field table in access
thanks
Adding Items To Combo Box In Excel...
How do you add list items to a combo box in excel without using code? Is there a way (like in vb) to add items to the "List" property?
Thanks,
Tom
Edit: Moved from Database
Add Items To A Combo Box And Make Them Stick
Hi i am fairly new to vb and i want to add items to a combo box at run time based on what a user types in a text box then i want these items to be saved in the combo box. I managed to add items but every time i exit the programme the combo box clears can u help?
Combo Box - Adding Many Items W/ A Loop?
okay, i searched around a lot, read a few books, and did a lot of research and i'm still not finding the answer to the seemingly simple task...
I need 8 combo boxes. (list box style)
Each combo box needs the numbers 1 through 100 as a selection.
I know there has to be a way to use a loop to write that, so i don't have to type in 800 numbers.
Any help would be much appreciated.
Thank you
Benjamin
Generating Auto Items For A Combo Box
I have 2 comboboxes on a form. One combobox has "Master Room Suits" and "Standard Room" as its items. Now what I need to do is when the user selects master room suite, the second combobox creates items labelled 1 to 5 . and standard room as 1 to 8. Does n e 1 know how to do this????
Combo Selected Items Into Listbox
I need help with an assignment I trying to populate my list box after the user clicks on the room number in my classroom scheduler project. How would I do this. I have attached my project for your review.
After I have assign the courses to the room number how can I make them go into list box the ones that where assigned when I select the room number. Also how can I clear one of the classes from the listbox after it has been populated Thanks for any assistance.
Split + Move Combo Box Items
I am working on a program that logs into aim on multiple accounts.
It has a combo box were the account:password is loaded, in a line by line form like:
Account:Password
Account:Password
Account:Password
And so on... I need to make it so that it basically press's down to bring the next account:password into the main field, making it readable, then log into aim with it, using tocsock.
Code:
Private Sub tocSock1_incomingChatID(Index As Integer, strRoom As String, lngId As Long)
Dim a As Integer
Dim sn(Slider1.Value) As String
Dim pw(Silder1.Value) As String
For a = 1 To Slider1.Value
tocsock1(a).loginUser sn(a) pw(a)
Next a
End Sub
That is the code so far. sn will be replaced with the correct control name.property of the split, being the text before :
pw will be replaced with the second part of the split.
I believe my code is correct, I just have to make it perform a split, and after each attempt, move the combo box to the NEXT account, following the one it was just on. It should start socket 1 with the 1st one in the slot, not with the blank part, which would be the (0) of the combobox.
Thanks alot in advance, I hope I explained it enough!
EDIT: The Slider control is what selects how many sockets will be used, which is what "a" is. Thanks!
Combo Box With Bold Text Items
Hello. I have a combo box with many items but I simply want to make one of these items bold. I'm a bit of a novice to VB so nothing to complex please! Its probably only a line anyway...
thanks.
Saving New Items To A Combo Box In Runtime
Hi, Could anyone help please?
My program has a 5 combo boxes. "cboPC", "cboLap", "cboGen", "cboCable" and "cboAdd" and a text box "txtItem". In "cboAdd" there are the choices of the other 4 combo boxes in it. What i would like is when the Add button is clicked, it adds "txtItem" to the combo box chosen from "cboAdd" and saves it so that when the form is reloaded it is still there.
I have been told i need to write it to a file, but dont know how to do this? Help appreciated!
Here is the code i have so far for adding it to the combo boxes:
Code:
Private Function AddItem()
If cboCat.Text = "PC" Then
cboPC.AddItem txtAddItem.Text
ElseIf cboCat.Text = "Laptop" Then
cboLap.AddItem txtAddItem.Text
ElseIf cboCat.Text = "Cable" Then
cboCab.AddItem txtAddItem.Text
ElseIf cboCat.Text = "Backup" Then
cboBack.AddItem txtAddItem.Text
ElseIf cboCat.Text = "ID" Then
cboCard.AddItem txtAddItem.Text
ElseIf cboCat.Text = "General" Then
cboGen.AddItem txtAddItem.Text
End If
End Function
Setting Some Items In Combo Box As Bold
Hey,
I know it's possible to set all the items in a combo box to bold, but I wanted to know if it's possible to set only some items as bold, which ever i choose...
Thanks in advance...
|