Hi,
As far as i can tell this can't be done, but thought i'd quickly ask, I have
4 labels in my combobox, and i want to add them to the box with a numeric
"value" and then get that value of the currently selected item. I want the
combobox to display the text not the value of course..
Is this possible with the standard combobox??
Thanks,
Dan
Nov 20 '05
12 1215
Hi Dan,
While that will certainly work for a few items, here's a couple of
suggestions.
With the code that you have, you use Coption once and then discard it.
Then you declare and use Coption2, and so on. You could simply keep using
Coption each time. Coption = New ComboItem.
What I would do, though, is add a constructor to the ComboItem class
Class ComboItem
: : :
Public Sub New (ThisName As String, ThisOptionValue As Integer)
Name = ThisName
OptionValue = ThisOptionValue
End Sub
End Class
Then it can be initialised like so:
aComboBox.Items .Add (New ComboItem ("Unacceptable" , 100))
aComboBox.Items .Add (New ComboItem ("Major Non-Comp", 50))
aComboBox.Items .Add (New ComboItem ("Minor Non-Comp", 20))
aComboBox.Items .Add (New ComboItem ("Satisfactory" , 9))
Regards,
Fergus
Ah, Excellent thats exactly the sort of thing i should have been thinking
of.
I did try re-using Coption by the way, and it didnt work, I got the last
item i'd added 4 times.. This confused me a lot! strange.
Thanks for all your help tonight, I owe you a beer!
Dan
"Fergus Cooney" <fi******@tesco .net> wrote in message
news:eu******** ******@TK2MSFTN GP11.phx.gbl... Hi Dan,
While that will certainly work for a few items, here's a couple of suggestions.
With the code that you have, you use Coption once and then discard it. Then you declare and use Coption2, and so on. You could simply keep using Coption each time. Coption = New ComboItem.
What I would do, though, is add a constructor to the ComboItem class
Class ComboItem : : : Public Sub New (ThisName As String, ThisOptionValue As Integer) Name = ThisName OptionValue = ThisOptionValue End Sub End Class
Then it can be initialised like so: aComboBox.Items .Add (New ComboItem ("Unacceptable" , 100)) aComboBox.Items .Add (New ComboItem ("Major Non-Comp", 50)) aComboBox.Items .Add (New ComboItem ("Minor Non-Comp", 20)) aComboBox.Items .Add (New ComboItem ("Satisfactory" , 9))
Regards, Fergus
Hi Dan,
I caught myself before it was too late, but I almost recommended that very
mistake!!
The idea is that you can reuse Coption the <variable> but you have to give
it a New ComboItem each time.
This central heating makes me thirsty, so thanks for the beer! We're in
the same timezone so I'll see you in the Dog and Crown in half an hour!! ;-)
Regards,
Fergus This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Eva |
last post by:
Hi,
I try to implement quick sort. I sort vectors by their first value.
10 2 3 4
9 3 5 6
10 4 5 6
must be
9 3 5 6
10 2 3 4
10 4 5 6
The prog works great on maybe 500 vectors, but I have an "Aborted(core
|
by: Martin Dew |
last post by:
hi, I want to interogate the Quick Launch folder, looking at each icon and
getting the image, and target that it fires when clicked. I can get to the
folder and create a filelist of the icons, but cannot seem to find where to
go from there, can anyone help ?
string dirPath =
Path.Combine(System.Environment.GetEnvironmentVariable(Environment.SpecialFolder.ApplicationData),@"Microsoft\Internet
Explorer\Quick Launch");
|
by: Rudy |
last post by:
Hello all!
Have a quick question on drop down list. Need to make a year ddl, 1900 to
1987. Is there a quick way to do this. I'm not binding this, just loading it
in the items collection.
Thanks!!!
Rudy
|
by: Chrysan |
last post by:
I have a popup window, which consist of 2 combobox. The second
combobox's(cboCube) item collection will change based on the first
combobox's(cboDatabase) event(selectedindex_changed) is fired. And, I do have
write such code in code-behind as follow:
Private Sub cboDatabase_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles cboDatabase.SelectedIndexChanged
Dim strAdomdConnectionString As String
Try
|
by: dembla |
last post by:
Hey Frnds can anyone help me in this
i need a program in 'c'
PROGRAM to print NxN Matrix
9 1 8 1 2 3
2 7 3 as 4 5 6
6 4 5 7 8 9
in sorted form
| |
by: WhatsPHP |
last post by:
I like HTML Quick Form and think that it is a great tool.. but I still
havent found any documentation that tells me how to use HTML Quick
Forms with my own table and my own layout. Is this possible?
Instead of the default positioning of form items the way it is done in
HTML Quick forms?
Thanks
WhatsPHP
|
by: questionit |
last post by:
Hi Experts
I need to write a small stack very basic program. It will only do the following:
- pop item
- push item
- count number of items in stack
But difficulty i have is how to implement it using Ms Access - form ?
|
by: neehakale |
last post by:
I know that heap sort,quick sort and merg sort are the faster sorting algoritms than the bubble sort,selection sort,shell sort and selection sort.
I got an idea,in which situation we can use bubble sort(use when we have to 100 items: bubble sort is effective),shell sort is effective when one has to sort near abt 5000 items..selection sort is effective for sorting 1000 items...and more than 1000 and less than 5000 items if u have to sort use...
|
by: NvrBst |
last post by:
A few quick questions if possible.
1 - If I have a "List<..myList" and set it as a datasouce for say
ListBox1, then change items in "myList" is the correct/only way to
update the ListBox with the following?
ListBox1.DataSource = null;
ListBox1.DataSource = myList;
2 - BindingList<...is the same as List<...except when it is set as
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |