TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
rsuguna1
NA
1
0
passing vlaue from 1 form to another
May 16 2005 1:20 AM
i'm trying to get a value from the textbox in Form A, FormWizIntervalTime and store it in a container class, ScheduleContainer. The stored value is retrived by Form B, FormWizConfirm into a txtbox. I have used property to get n set the values in ScheduleContainer. here r the codes... In Form A: class FormWizIntervalTime { ..... private void txtScdName_Validating(object sender, System.ComponentModel.CancelEventArgs e) { //yewchong - You declare a new object here, so new memory is being assigned ScheduleContainer strName = new ScheduleContainer(); strName.SetScheduleName = txtScdName.Text.ToString(); /*if(strName =="" ) } in class SchduleContainer { ...... private string sName; public string SetScheduleName { set { //FormWizIntervalTime form = new FormWizIntervalTime(); sName = value; MessageBox.Show(sName); } get { return sName; //MessageBox.Show(sName); } } } Lastly in class FormWizConfirm { ........ private ScheduleContainer name; private void FormWizConfirmation_Load(object sender, System.EventArgs e) { //yew chong - over here, you declared another new object, therefore new memory //will be assigned again, therefore the values would not be able to be passed over. name = new ScheduleContainer(); txtCName.Text = name.SetScheduleName; // string i = "text"; //name.SetScheduleName = i; //txtCName.Text = i; MessageBox.Show(txtCName.Text); } } the problem is...when the FormWizConfirm loads, its not displaying the value set in Form A(showing a blank txtfield). there are 2 more forms between FormWizIntervalTime and FormWizConfirm. thanks in advance!
Reply
Answers (
1
)
How can I set a property value by its name?
Handling Win32 Events In My Application