Click here to Skip to main content
15,914,165 members
Home / Discussions / C#
   

C#

 
GeneralRe: Windows Service Question. Pin
HakunaMatada13-Dec-05 17:07
HakunaMatada13-Dec-05 17:07 
AnswerRe: Windows Service Question. Pin
Dave Kreskowiak12-Dec-05 19:54
mveDave Kreskowiak12-Dec-05 19:54 
Questionarranging ownedforms(owner-ownedform) Pin
tonato84812-Dec-05 17:41
tonato84812-Dec-05 17:41 
AnswerRe: arranging ownedforms(owner-ownedform) Pin
HakunaMatada12-Dec-05 18:23
HakunaMatada12-Dec-05 18:23 
QuestionHow to lock background forms when foreground form is active? Pin
2hdass12-Dec-05 17:24
2hdass12-Dec-05 17:24 
AnswerRe: How to lock background forms when foreground form is active? Pin
Christian Graus12-Dec-05 17:42
protectorChristian Graus12-Dec-05 17:42 
AnswerRe: How to lock background forms when foreground form is active? Pin
HakunaMatada12-Dec-05 18:12
HakunaMatada12-Dec-05 18:12 
QuestionSimple .Net 2.0 Data Binding question (WinForms) Pin
Furty12-Dec-05 15:46
Furty12-Dec-05 15:46 
I'm wrestling with the new Windows Forms data binding in .Net 2.0 without much luck.

Here's my data binding source object:

    public class UserCredentials<br />
    {<br />
        #region Fields<br />
<br />
        private string userName;<br />
        private string password;<br />
<br />
        #endregion<br />
<br />
        #region Properties<br />
<br />
        /// <summary><br />
        /// Gets or Sets the user name<br />
        /// </summary><br />
        public string UserName<br />
        {<br />
            get { return userName; }<br />
            set { userName = value; }<br />
        }<br />
<br />
        /// <summary><br />
        /// Gets or Sets the password<br />
        /// </summary><br />
        public string Password<br />
        {<br />
            get { return password; }<br />
            set { password = value; }<br />
        }<br />
<br />
        #endregion<br />
    }


I then create a simple Form with TextBoxes for the user name and password, and bind the Text property to the relevant properties in my binding source. I also have some simple validation code to check that data has been entered, and have provided a Cancel button on the Form so the user can back out of any changes made.

In the form's constructor I set the DataSource property of the BindingSource to an instance of the UserCredentials class. So far so good, the UserName and Password properties of the UserCredentials class are binding to my two TextBoxes just fine.

The problem is, I can't find any way to roll-back the changes made to my UserCredentials instance if validation fails, or the user clicks Cancel.

I'm sure it's very simple, but I just can't see it right now.. Any ideas?
AnswerRe: Simple .Net 2.0 Data Binding question (WinForms) Pin
Ista12-Dec-05 16:09
Ista12-Dec-05 16:09 
GeneralRe: Simple .Net 2.0 Data Binding question (WinForms) Pin
Furty12-Dec-05 16:14
Furty12-Dec-05 16:14 
AnswerRe: Simple .Net 2.0 Data Binding question (WinForms) Pin
bismark12-Dec-05 17:14
bismark12-Dec-05 17:14 
GeneralRe: Simple .Net 2.0 Data Binding question (WinForms) Pin
Furty12-Dec-05 17:51
Furty12-Dec-05 17:51 
Questionzoom? Pin
bobisreallycool12-Dec-05 14:49
bobisreallycool12-Dec-05 14:49 
AnswerRe: zoom? Pin
Ista12-Dec-05 15:47
Ista12-Dec-05 15:47 
AnswerRe: zoom? Pin
Christian Graus12-Dec-05 15:49
protectorChristian Graus12-Dec-05 15:49 
Questionhelp me Pin
Rosayne12-Dec-05 14:03
Rosayne12-Dec-05 14:03 
AnswerRe: help me Pin
Christian Graus12-Dec-05 14:04
protectorChristian Graus12-Dec-05 14:04 
AnswerRe: help me Pin
bismark12-Dec-05 17:16
bismark12-Dec-05 17:16 
QuestionProxy with authentication retire something Pin
icerein12-Dec-05 13:58
icerein12-Dec-05 13:58 
AnswerRe: Proxy with authentication retire something Pin
Jared Parsons12-Dec-05 14:22
Jared Parsons12-Dec-05 14:22 
GeneralRe: Proxy with authentication retire something Pin
icerein12-Dec-05 19:11
icerein12-Dec-05 19:11 
GeneralRe: Proxy with authentication retire something Pin
Jared Parsons13-Dec-05 7:44
Jared Parsons13-Dec-05 7:44 
GeneralRe: Proxy with authentication retire something Pin
icerein13-Dec-05 13:59
icerein13-Dec-05 13:59 
GeneralRe: Proxy with authentication retire something Pin
Jared Parsons14-Dec-05 4:52
Jared Parsons14-Dec-05 4:52 
GeneralRe: Proxy with authentication retire something Pin
icerein14-Dec-05 13:58
icerein14-Dec-05 13:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.