473,395 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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.ObjectCollection.

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(value)
ReDim Preserve ItemData(Me.Items.Count)
End Sub

Private Sub InitializeComponent()
Me.ComboBox1 = New System.Windows.Forms.ComboBox()
Me.ComboBox1.Location = New System.Drawing.Point(17, 17)
Me.ComboBox1.Name = "ComboBoxVB6_"
Me.ComboBox1.TabIndex = 0
Me.ComboBox1.Text = "ComboBoxVB6_"

End Sub
End Class

Jan 22 '06 #1
0 2160

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

Similar topics

3
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...
8
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...
8
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...
1
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...
1
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...
5
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...
2
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...
6
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...
1
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
tracyyun
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...
0
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,...

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.