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
Arun Kurmi
NA
104
103.3k
To Refer Control From Previous Page in WindowsFormApplicatio
Mar 13 2013 2:37 PM
hi friends,
I want to refer control from previous page in windows form application. On the form1 i have a textbox1 and listbox1 and form2 contain two label as label1 and label2. On the loading of form2 i want display the result of textbox1 on label1 and the result of listbox1 on label2.
I tried below code :
------------------------------------Form-1----------------------------------------------
namespace msg
{
public partial class ToReferControlFromPrevPage_prev_page_ : Form
{
public ToReferControlFromPrevPage_prev_page_()
{
InitializeComponent();
}
//private void ToReferControlFromPrevPage_prev_page__Load(object sender, EventArgs e)
public void ToReferControlFromPrevPage_prev_page__Load(object sender, EventArgs e)
{
listBox1.Items.Add("Emp id : a_108");
listBox1.Items.Add("Age 24");
listBox1.Items.Add("Post: Developer");
listBox1.Items.Add("mob : 9977668018");
listBox1.Items.Add("Add : Indore");
}
//private void textBox1_TextChanged(object sender, EventArgs e)
public void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}
----------------------------------------Form-2------------------------------------------
namespace msg
{
public partial class ToReferControlFromPrevPage_next_page_ : Form
{
public ToReferControlFromPrevPage_next_page_()
{
InitializeComponent();
}
private void ToReferControlFromPrevPage_next_page__Load(object sender, EventArgs e)
{
ToReferControlFromPrevPage_prev_page_ p1 = Application.OpenForms ["ToReferControlFromPrevPage_prev_page_"] as ToReferControlFromPrevPage_prev_page_;
label1.Text = p1.textBox1.Text;
}
}
}
Reply
Answers (
2
)
Change Connection String in app.config with code
updating datagrid in c' using oledb