Click here to Skip to main content
15,885,546 members
Home / Discussions / C#
   

C#

 
AnswerRe: Use the environment provided by the application instead from system environment. Pin
PIEBALDconsult14-Dec-11 1:45
mvePIEBALDconsult14-Dec-11 1:45 
SuggestionRe: Use the environment provided by the application instead from system environment. Pin
Shameel14-Dec-11 2:02
professionalShameel14-Dec-11 2:02 
QuestionDisplay a menu in context menu Pin
sarang_k14-Dec-11 0:00
sarang_k14-Dec-11 0:00 
AnswerRe: Display a menu in context menu Pin
BillWoodruff14-Dec-11 2:48
professionalBillWoodruff14-Dec-11 2:48 
QuestionHow I can Show the Value of Textbox in another form in C sharp? Pin
ishaq shinwari13-Dec-11 21:25
ishaq shinwari13-Dec-11 21:25 
AnswerRe: How I can Show the Value of Textbox in another form in C sharp? Pin
Pete O'Hanlon13-Dec-11 21:37
mvePete O'Hanlon13-Dec-11 21:37 
GeneralRe: How I can Show the Value of Textbox in another form in C sharp? Pin
ishaq shinwari13-Dec-11 22:26
ishaq shinwari13-Dec-11 22:26 
GeneralRe: How I can Show the Value of Textbox in another form in C sharp? Pin
Pete O'Hanlon13-Dec-11 23:01
mvePete O'Hanlon13-Dec-11 23:01 
The common way to do this is to have an event in your code that looks something like this:
C#
public event EventHandler<string> MyText;

protected void OnMyTextChanged()
{
  EventHandler<string> handler = MyText;
  if (handler == null)
  {
    return;
  }
  handler(this, new TextChangedEventArgs(textBox.Text));
}
Then, all you need do is subscribe to the event in the second form, and it will automatically receive the string whenever you raise this event (which you would trigger from your button click event). Note that TextChangedEventArgs is a custom event args class defined like this:
C#
public class TextChangedEventArgs : EventArgs
{
  public TextChangedEventArgs(string text) : base()
  {
    MyText = text;
  }
  public string MyText { get; private set; }
}

Forgive your enemies - it messes with their heads

"Mind bleach! Send me mind bleach!" - Nagy Vilmos


My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility


AnswerRe: How I can Show the Value of Textbox in another form in C sharp? Pin
Varun Sareen13-Dec-11 23:12
Varun Sareen13-Dec-11 23:12 
QuestionPLD's quastion (storage binding) Pin
desatir731613-Dec-11 20:48
desatir731613-Dec-11 20:48 
AnswerRe: PLD's quastion (storage binding) Pin
Pete O'Hanlon13-Dec-11 21:51
mvePete O'Hanlon13-Dec-11 21:51 
AnswerRe: PLD's quastion (storage binding) Pin
jan lucas13-Dec-11 23:05
jan lucas13-Dec-11 23:05 
AnswerRe: PLD's quastion (storage binding) Pin
Deborah Palmer McCain14-Dec-11 10:35
Deborah Palmer McCain14-Dec-11 10:35 
QuestionVS 2010 No method to override error Pin
Deborah Palmer McCain13-Dec-11 14:23
Deborah Palmer McCain13-Dec-11 14:23 
AnswerRe: VS 2010 No method to override error Pin
PIEBALDconsult13-Dec-11 15:27
mvePIEBALDconsult13-Dec-11 15:27 
GeneralRe: VS 2010 No method to override error Pin
Deborah Palmer McCain13-Dec-11 16:27
Deborah Palmer McCain13-Dec-11 16:27 
GeneralRe: VS 2010 No method to override error Pin
PIEBALDconsult14-Dec-11 1:58
mvePIEBALDconsult14-Dec-11 1:58 
AnswerRe: VS 2010 No method to override error Pin
BillWoodruff13-Dec-11 15:43
professionalBillWoodruff13-Dec-11 15:43 
GeneralRe: VS 2010 No method to override error Pin
Deborah Palmer McCain13-Dec-11 16:23
Deborah Palmer McCain13-Dec-11 16:23 
AnswerRe: VS 2010 No method to override error Pin
Luc Pattyn13-Dec-11 19:08
sitebuilderLuc Pattyn13-Dec-11 19:08 
GeneralRe: VS 2010 No method to override error Pin
PIEBALDconsult14-Dec-11 1:57
mvePIEBALDconsult14-Dec-11 1:57 
GeneralRe: VS 2010 No method to override error Pin
Deborah Palmer McCain14-Dec-11 10:10
Deborah Palmer McCain14-Dec-11 10:10 
AnswerRe: VS 2010 No method to override error [Long Post] Pin
Keith Barrow13-Dec-11 22:09
professionalKeith Barrow13-Dec-11 22:09 
GeneralRe: VS 2010 No method to override error [Long Post] Pin
Deborah Palmer McCain14-Dec-11 10:03
Deborah Palmer McCain14-Dec-11 10:03 
AnswerRe: VS 2010 No method to override error Pin
Richard MacCutchan13-Dec-11 22:23
mveRichard MacCutchan13-Dec-11 22:23 

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.