473,769 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Overriding Control Properties (e.g. Combobox Items.Add)

Hi guys,

I'm currently trying to implement the VB6-ItemsData property into a
CombolBox and it works so far, but there is one problem...

I can only inherit one class to another class, which is either
a) System.Windows. Forms.ComboBox or
b) System.Windows. Forms.ComboBox. ObjectCollectio n.

If I add (a) I can't override Items.Add.
If I add (b) I would have to write a Sub New with MyBase.New or
MyClass.New and I don't know how to add new items to the list (since I
override the Add function). What can I do?

Thanks in advance for your help!

Please find my code below.

Best Regards,

HKSHK

Public Class ComboBoxVB6
Inherits System.Windows. Forms.ComboBox
Friend WithEvents ComboBox1 As System.Windows. Forms.ComboBox

Public ItemData() As Integer

Public Sub AddItem(ByVal value As Object)
Me.Items.Add(va lue)
ReDim Preserve ItemData(Me.Ite ms.Count)
End Sub

Private Sub InitializeCompo nent()
Me.ComboBox1 = New System.Windows. Forms.ComboBox( )
Me.ComboBox1.Lo cation = New System.Drawing. Point(17, 17)
Me.ComboBox1.Na me = "ComboBoxVB 6_"
Me.ComboBox1.Ta bIndex = 0
Me.ComboBox1.Te xt = "ComboBoxVB 6_"

End Sub
End Class

Jan 22 '06 #1
0 2180

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
7495
by: Wayne Wengert | last post by:
I am trying to populate a combobox with a lisy of items. I want the 1st item to be "Make a Selection" and the following items will be names from a table in my DB (See code below). When I run the project, the combox box initially displays an empty selection. When I click on the drop down arrow I see the "Make a Selection" followed by the other choices. How can I move everything up so that the "Make a Selection" is the default value in...
8
16670
by: deko | last post by:
I'm trying to find a way to set form/control properties programmatically. In a nut shell: 1. Open a database 2. Open a form in design view 3. Do something like this: For Each prp In frm.Properties If prp.Name = rst!PropName Then prp = rst!ChangeTo
8
3363
by: deko | last post by:
I'm hoping someone can sanity check my understanding of the Object Model for Forms/Controls. I'm having trouble drilling down into Control properties. First, I have a record set with the following for a given Form: 1)Container
1
3017
by: Saso Zagoranski | last post by:
I posted a similar message before but perhaps I didn't explain enough what the problem is... I add items to the combobox during runtime depending on what the user types... the problem is that everytime the user types something (and I add items to the combobox) the cursor is moved to the left side of the combobox, like this: |a |ba
1
5355
by: Geir Sanne | last post by:
hi!!! is it possible to set the backcolor to red of the items in a combobox and make the combo itself be white as it is default ? when i set combobox.backcolor i set both combox backcolor and combobox items backcolor. -Geir
5
1534
by: TS | last post by:
This is getting very frustrating. I placed the same question before twice and got no response. Hopefully I'll get one this time. What I want to do is to restrict the items in one of the cbo boxes in my windows form based on what is selected in another cbo box. Example: When I choose "George" from the cbo box that shows the clients last names, I want when I click on the cbo box that shows the first names to see only the first names who have...
2
1320
by: elwaly | last post by:
Hi evry one, I want to build a group of comboboxs that have 3 to 6 items but initially i want them to start blank on run time, And show the first item when I press a command button i.e. Each combobox shows it's first item(0). thanks.
6
6876
by: AMP | last post by:
Hello, I have an mdi program with a child form ("A") and another child ("B"). I want to change the text of a label on A by changing an item from a combobox on B. I can code the comboBox1_SelectedIndexChanged that is on B but I dont know how to send that info to the label on A.I cant seem to access A from B. Help Thanks Mike
1
14707
by: JAnn81 | last post by:
I have a combo box created using xaml. I bind the item source to a xml document. <Items> <Item> <Name>David</Name> <Age>20</Age> </Item> <Item> <Name>Marcus</Name> <Age>25</Age>
0
9579
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10208
Oralloy
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...
0
10038
jinu1996
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...
0
8867
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7404
isladogs
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...
0
5294
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...
1
3952
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
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.