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

C#

 
GeneralRe: Speechlib Pin
wernlin26-Nov-13 1:39
wernlin26-Nov-13 1:39 
GeneralRe: Speechlib Pin
Dave Kreskowiak26-Nov-13 4:13
mveDave Kreskowiak26-Nov-13 4:13 
GeneralRe: Speechlib Pin
wernlin27-Nov-13 5:30
wernlin27-Nov-13 5:30 
Questionchange text from form Pin
messages25-Nov-13 3:33
messages25-Nov-13 3:33 
AnswerRe: change text from form Pin
Richard MacCutchan25-Nov-13 4:54
mveRichard MacCutchan25-Nov-13 4:54 
GeneralRe: change text from form Pin
messages25-Nov-13 5:20
messages25-Nov-13 5:20 
GeneralRe: change text from form Pin
Richard MacCutchan25-Nov-13 5:39
mveRichard MacCutchan25-Nov-13 5:39 
GeneralRe: change text from form Pin
messages25-Nov-13 5:50
messages25-Nov-13 5:50 
GeneralRe: change text from form Pin
Richard MacCutchan25-Nov-13 6:23
mveRichard MacCutchan25-Nov-13 6:23 
AnswerRe: change text from form Pin
OriginalGriff25-Nov-13 5:04
mveOriginalGriff25-Nov-13 5:04 
GeneralRe: change text from form Pin
messages25-Nov-13 5:19
messages25-Nov-13 5:19 
GeneralRe: change text from form Pin
OriginalGriff25-Nov-13 5:23
mveOriginalGriff25-Nov-13 5:23 
GeneralRe: change text from form Pin
messages25-Nov-13 5:48
messages25-Nov-13 5:48 
GeneralRe: change text from form Pin
OriginalGriff25-Nov-13 6:00
mveOriginalGriff25-Nov-13 6:00 
GeneralRe: change text from form Pin
messages25-Nov-13 6:32
messages25-Nov-13 6:32 
GeneralRe: change text from form Pin
OriginalGriff25-Nov-13 7:59
mveOriginalGriff25-Nov-13 7:59 
GeneralRe: change text from form Pin
messages26-Nov-13 3:59
messages26-Nov-13 3:59 
GeneralRe: change text from form Pin
OriginalGriff26-Nov-13 5:01
mveOriginalGriff26-Nov-13 5:01 
You use a property to access the data, but you use an Event to tell the other form when you have new data for it.

Think about it: the logic needs to be that the user types on one form, and presses a button. The text needs to be available via a property (or the other form can't access it) but the other form needs to know when the user has finished typing and pressed the button! So you have a property to get the data, and a event to tell you when to read it.

A property is easy to define:
C#
public string MyProperty
   {
   get { return myTextBox.Text; }
   set { myTextBox.Text = value; }
   }
Declares a property of type "string" called MyProperty, that Form1 can access:
C#
Form2 f2 = new Form2();
f2.MyProperty = "hello!";
...

GeneralRe: change text from form Pin
messages26-Nov-13 5:22
messages26-Nov-13 5:22 
GeneralRe: change text from form Pin
OriginalGriff26-Nov-13 5:56
mveOriginalGriff26-Nov-13 5:56 
AnswerRe: change text from form Pin
BillWoodruff25-Nov-13 5:08
professionalBillWoodruff25-Nov-13 5:08 
GeneralRe: change text from form Pin
messages25-Nov-13 5:26
messages25-Nov-13 5:26 
GeneralRe: change text from form Pin
BillWoodruff25-Nov-13 12:39
professionalBillWoodruff25-Nov-13 12:39 
AnswerRe: change text from form Pin
Vinh Nguyen26-Nov-13 0:01
Vinh Nguyen26-Nov-13 0:01 
QuestionHow can I access the properties of this object? Pin
turbosupramk325-Nov-13 3:20
turbosupramk325-Nov-13 3:20 

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.