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

Databinding problem with inherited class

Hello,

I have two classes A & B

public class A : B
{
private string lastname;

public string LastName
{
get{};
}
}

public class B
{
private string firstname;

public string FirstName
{
get{};
}
}

Class A inherits from B. When I try to databind the field FirstName, an
error occurs

MyTextBox.DataBindings.Add("Text", A, "FirstName"). It seems the databinding
does not see the property "FirstName", what I'm doing wrong?

Thanks for your help.

BRgds,
Olivier.
Nov 16 '05 #1
2 1134
pardon,
what error?

Best wishes,
P.
"Olivier Deborne" <ol*************@free.fr> wrote in message
news:OB**************@TK2MSFTNGP10.phx.gbl...
Hello,

I have two classes A & B

public class A : B
{
private string lastname;

public string LastName
{
get{};
}
}

public class B
{
private string firstname;

public string FirstName
{
get{};
}
}

Class A inherits from B. When I try to databind the field FirstName, an
error occurs

MyTextBox.DataBindings.Add("Text", A, "FirstName"). It seems the databinding does not see the property "FirstName", what I'm doing wrong?

Thanks for your help.

BRgds,
Olivier.

Nov 16 '05 #2
hi nair,

i raised one question in the same group, with subject title"threads". help
me please.

thanks
Tpool

"Nair" <Na**@discussions.microsoft.com> wrote in message
news:CF**********************************@microsof t.com...
public class A : B
{
private string lastname="Unni";

public string LastName
{
get{return this.lastname;}
}
}

public class B
{
private string firstname="Krishnan";

public string FirstName
{
get{return this.firstname;}
}
}
A a = new A();
textBox1.DataBindings.Add("Text",a,"LastName");

2 things, initialise the lastname in the class and instantiate the class
as
well. This worked.

"Prokrust" wrote:
pardon,
what error?

Best wishes,
P.
"Olivier Deborne" <ol*************@free.fr> wrote in message
news:OB**************@TK2MSFTNGP10.phx.gbl...
> Hello,
>
> I have two classes A & B
>
> public class A : B
> {
> private string lastname;
>
> public string LastName
> {
> get{};
> }
> }
>
> public class B
> {
> private string firstname;
>
> public string FirstName
> {
> get{};
> }
> }
>
> Class A inherits from B. When I try to databind the field FirstName, an
> error occurs
>
> MyTextBox.DataBindings.Add("Text", A, "FirstName"). It seems the

databinding
> does not see the property "FirstName", what I'm doing wrong?
>
> Thanks for your help.
>
> BRgds,
> Olivier.
>
>


Nov 16 '05 #3

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

Similar topics

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...
0
by: Ian | last post by:
I have sub-classed the Page class in order to provide some base properties and methods that every page on my site will need access to. I would like to have these things show up in the Simple...
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...
3
by: Kevin Swanson | last post by:
I'm writing what should be a very simple app against an Oracle database. The app has a number of user controls, any one of which is loaded into a main display page using the loadControl method,...
8
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got...
5
by: Mark R. Dawson | last post by:
Hi all, I may be missing something with how databinding works but I have bound a datasource to a control and everything is great, the control updates to reflect the state of my datasource when I...
7
by: Pieter | last post by:
Hi, I'm looking for a DateTimePicker that supports 100% databinding (and support null-values)... It's a shame that the normal control doesn't, but when searching on the internet, I didn't find...
9
by: Nathan Sokalski | last post by:
I have a very simple UserControl which contains an Image and a Label, which I use to display an image with a caption. I am using this control inside a DataList, setting the two Public variables...
8
by: Dirk | last post by:
Hello, I have a problem to use databinding with my business layer classes. My data class does not have simple properties (string, int or datetime), instead, all my properties are objects of the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.