Click here to Skip to main content
15,888,351 members
Home / Discussions / C#
   

C#

 
AnswerRe: For Loop Pattern to use in Parsing - C# code Pin
gamer112728-Jul-09 5:15
gamer112728-Jul-09 5:15 
AnswerRe: For Loop Pattern to use in Parsing - C# code Pin
harold aptroot28-Jul-09 6:05
harold aptroot28-Jul-09 6:05 
AnswerRe: For Loop Pattern to use in Parsing - C# code Pin
PIEBALDconsult28-Jul-09 6:11
mvePIEBALDconsult28-Jul-09 6:11 
QuestionFiring up the event when string text is changed Pin
Blubbo28-Jul-09 4:15
Blubbo28-Jul-09 4:15 
AnswerRe: Firing up the event when string text is changed Pin
Vimalsoft(Pty) Ltd28-Jul-09 4:19
professionalVimalsoft(Pty) Ltd28-Jul-09 4:19 
GeneralRe: Firing up the event when string text is changed Pin
Blubbo28-Jul-09 4:22
Blubbo28-Jul-09 4:22 
GeneralRe: Firing up the event when string text is changed Pin
Vimalsoft(Pty) Ltd28-Jul-09 4:30
professionalVimalsoft(Pty) Ltd28-Jul-09 4:30 
GeneralRe: Firing up the event when string text is changed Pin
Ian Shlasko28-Jul-09 4:30
Ian Shlasko28-Jul-09 4:30 
I think he's going the other way... Updating the textbox when the string changes.

There are plenty of ways to do this, and people will vehemently disagree on which is best, but here's one possible method:

1) Have your class implement the System.ComponentModel.INotifyPropertyChanged interface, and add the PropertyChanged event as specified in the interface

2) Add a wrapper for it, just to keep things clean:
private void OnPropertyChanged(string propName)
{
   if (PropertyChanged != null)
      PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propName));
}


3) Instead of having the string just be a variable, change it into a property, like so:

private string _myStringValue;
public string MyProperty
{
  get { return _myStringValue; }
  set { _myStringValue = value; PropertyChanged("MyProperty"); }
}


Then you just listen to the PropertyChanged event, and update the textbox when "MyProperty" comes through.

Proud to have finally moved to the A-Ark. Which one are you in?
Developer, Author (Guardians of Xen)

GeneralRe: Firing up the event when string text is changed Pin
Blubbo28-Jul-09 4:34
Blubbo28-Jul-09 4:34 
GeneralRe: Firing up the event when string text is changed Pin
Ian Shlasko28-Jul-09 4:38
Ian Shlasko28-Jul-09 4:38 
GeneralRe: Firing up the event when string text is changed [modified] Pin
Blubbo28-Jul-09 4:46
Blubbo28-Jul-09 4:46 
GeneralRe: Firing up the event when string text is changed Pin
Ian Shlasko28-Jul-09 6:04
Ian Shlasko28-Jul-09 6:04 
Question[Message Deleted] Pin
Vivek Vijayan28-Jul-09 4:09
Vivek Vijayan28-Jul-09 4:09 
AnswerRe: insert code not working Pin
moon_stick28-Jul-09 4:15
moon_stick28-Jul-09 4:15 
GeneralRe: insert code not working Pin
Vivek Vijayan28-Jul-09 4:24
Vivek Vijayan28-Jul-09 4:24 
GeneralRe: insert code not working Pin
Ian Shlasko28-Jul-09 4:36
Ian Shlasko28-Jul-09 4:36 
GeneralRe: insert code not working Pin
Vivek Vijayan28-Jul-09 4:37
Vivek Vijayan28-Jul-09 4:37 
GeneralRe: insert code not working Pin
musefan28-Jul-09 4:42
musefan28-Jul-09 4:42 
GeneralRe: insert code not working Pin
Vivek Vijayan28-Jul-09 4:50
Vivek Vijayan28-Jul-09 4:50 
GeneralRe: insert code not working Pin
musefan28-Jul-09 4:55
musefan28-Jul-09 4:55 
GeneralRe: insert code not working Pin
moon_stick28-Jul-09 4:43
moon_stick28-Jul-09 4:43 
GeneralRe: insert code not working Pin
Vivek Vijayan28-Jul-09 4:52
Vivek Vijayan28-Jul-09 4:52 
GeneralRe: insert code not working Pin
moon_stick28-Jul-09 5:07
moon_stick28-Jul-09 5:07 
GeneralRe: insert code not working Pin
moon_stick28-Jul-09 4:38
moon_stick28-Jul-09 4:38 
GeneralRe: insert code not working Pin
Vivek Vijayan28-Jul-09 4:44
Vivek Vijayan28-Jul-09 4:44 

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.