473,785 Members | 2,761 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Data binding to a custom control returns changed rows from browsing

Hi all,

Tearing my hair out on this one so hopefully somebody can help.

I have written a custom control to represent a button on a touchscreen EPoS
(electronic point of sale) peice of hardware. As part of my control I have
a property declared like so:

private byte posForeColor;
/// <summary>
/// Gets/Sets the byte that represents the foreground color for the PoS
hardware
/// </summary>
[Browsable(true) ,Category("Appe arance"),Descri ption("Gets/Sets the value of
the foreground color for the PoS hardware")]
public byte PosForeColor
{
get{return posForeColor;}
set
{
//set the private var.
posForeColor = value;
//Calculate actual windows colour to display on control.
convertor.Set(v alue);
ForeColor = convertor.ToSta ndardColor();
}
}

Just in case you wondered, the hardware stores it's colors as a single byte
(3 bits red, 3 bits Green, 2 bits Blue). I have an App that uses my custom
control, as well as a DataGrid that displays other information in the table
I am interested in. I have created the binding for my control like this:

//Sample pos button
Binding buttonFCBinding = new Binding("PosFor eColor",tblCons olidated,"FG");
//parseByteToStri ng takes the byte value from the control, and changes it to
the string hex representation stored in the Pos' xml file.
buttonFCBinding .Parse += new ConvertEventHan dler(parseByteT oString);
//formatStringToB yte takes a string representation of the colour byte (in
hex) from the Pos' xml file and changes it to an actual byte for the control
buttonFCBinding .Format += new ConvertEventHan dler(formatStri ngToByte);
//Add the binding
btnSample.DataB indings.Add(but tonFCBinding);

So far, so good. The the binding works fine, and as I scroll through my
data grid, the control changes appearance accordingly. Excellent!

When I am done with this screen I make a call to:

tblConsolidated .GetChanges(Dat aRowState.Modif ied)

My problem is that any row I have navigated to, returns itself as modified -
even if I havent changed a thing! I know it has something to do with my
control/property because if I bind something to lets say "Text" for example,
I dont get this behaviour. It is only when I bind to my own properties.

Does anybody know what is wrong. Am I missing an attribute or something.

Any help would greatly be appreciated.

Thanks,

Simon.

Nov 16 '05 #1
0 1218

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

Similar topics

6
1337
by: Brad | last post by:
I have a web service which returns a collection of class object (see below). I want to consume this service in another web application by binding it to a List control The data returns from the web service, however when I bind the data I get the following error **** DataBinder.Eval: 'UserServices.User' does not contain a property with the name FirstName. **** Debugging I see that the list controls data source is a System.Array with...
19
2347
by: Simon Verona | last post by:
I'm not sure if I'm going down the correct route... I have a class which exposes a number of properties of an object (in this case the object represents a customer). Can I then use this object to databind to text boxes etc? I can't use a dataset as the object has loads of derived logic, for example updating one property may actually update several database fields for example.
14
14659
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control so I get the ObjectDataSource. No problem ..... ObjectDataSource src = .... //is ok i have it
5
1606
by: raajakumars | last post by:
urgent!!!!!!! kindly please anyone help me....... actualy i am newbe to vb.net i need data to be inserted in to my table like this... sitenm cdate wrknm nowrk totwg tamiz palace 12/1/2007 Electrician 34 5100 tamiz palace 12/1/2007 Mason 5 900 instead my following code produces result like this..
0
9481
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
10155
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...
1
10095
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,...
0
8978
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...
0
6741
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();...
0
5383
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...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
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
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.