473,386 Members | 1,752 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,386 software developers and data experts.

DataBinding a Parameterized Property?

Hi all,

Although I tried several different ways, I wasn't able to succeed databinding a parameterized property. Can anyone help?

Thanks in advance,

AG
In a form with two text boxes on it, say in Load event, I write the following code:

1.Dim obj As New Person()
2.txtName.DataBindings.Add("Text", obj, "Name")
3.txtPhone.DataBindings.Add("Text", obj, "Phone(PhoneTypes.Home)")

Line 3 gives an error...

Public Enum PhoneTypes
Home = 0
Work = 1
Mobile = 2
End Enuö

Public Class Person
Private m_sName As String
Private m_colPhones as New HashTable()

Public Sub New()
m_sName = ""
m_colPhones.Add(PhoneTypes.Home, "")
m_colPhones.Add(PhoneTypes.Work, "")
m_colPhones.Add(PhoneTypes.Mobile, "")
End Sub

Public Property Name() As String
Get
Return m_sName
End Get
Set(Byval Value As String)
m_sName = Value
End Set
End Property

Public Property Phone(ByVal PhoneType As PhoneTypes) As String
Get
Return m_colPhones(PhoneType)
End Get
Set(ByVal Value As String)
If m_colPhones.ContainsKey(PhoneType) Then
m_colPhones(PhoneType) = Value
Else
m_colPhones.Add(PhoneType, Value)
End If
End Set
End Property

End Class

Nov 19 '05 #1
0 1121

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

Similar topics

7
by: Wayne Wood | last post by:
i posted this problem on microsoft.public.excel.programming, but there's no one replied till now. because this issue is time critical, i put it here to try my fortune :) ...
3
by: DraguVaso | last post by:
Hi, I'm having the following situation: - A class clsFournisseur with public property's which raise a MyPropertyChanged-event in the Set-method for each Property. Public Event NomChanged As...
1
by: Preston | last post by:
hello all... My friend using vb.net made a DLL file which contains a Property Kkk(ByVal key As Object) in it, I use CSharp and reference this DLL file, but in csharp object browser, there is no...
2
by: Colin Robinson | last post by:
Help please I have an example class called Person with 2 public properties Firstname and Lastname, I cant create a textbox on an asp.net form bound to the Person.Firstname property Can...
1
by: Gary Shell | last post by:
I have a pair of combo boxes on a form. Both have their SelectedValue property bound to a column on a table called "Input_Output". One column is called "Class" and the second is called "SubClass"....
7
by: Naveen | last post by:
I posted this message to another board and have hardly had any views on it, leave alone answers. So I am cross-posting here. This may be a very simple question but I can't get my head around it....
1
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hello to all, I want to know if DataBinding in asp.net 2,0 is better than to fill up the values of the controls of the following form: this.miControlTextBox.Text = valorParaControlTextbox; ...
3
by: Peter | last post by:
Hi! I am having some very strange behavior with my databound controls. It's taken a long time to isolate exactly what is provoking the problem, but I'm still leagues away from solving it. I...
4
by: Jason Wolf | last post by:
I have an object which runs in a sperate thread, from the main thread, and while running it updates a public property. In my main form I defined databinding on the property and I would like to see...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
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...

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.