Hi there,
I am new to C# and was wondering if someone can help me with an issue with a windows app that I am currently working on?
I have two forms Form1 and Form2 I have a string varible in both forms. I call Form2 from Form1 via a menu option and would like to send a string value from Form2 to Form1 via a button click event. The idea is that the user will go itno the options menu on Form1 go to Form2 and make changes to the layout etc which calls a file location string to be passed back to Form1 when the user clicks OK.
I have manged to call Form2 from Form1 ok using the below but I am not sure how to pass the string back once the user has finished?
I would be greatful if someone could point me in the right direction?
Loading
reginald knightPosted Apr 23, 2008, 7:01 AM
I have question regarding this error when trying to go to the next page. I have a next and back button with the following code and error. could anyone help me out?
private
void backButton_Click(object sender, EventArgs e){
FrmReg1 frm =
new FrmReg1();frm.Show();
frm.Hide();
frm.Close();
FrmReg2 frm =
new FrmReg2();frm.Show();
frm.Hide();
frm.Close();
Error:The type or namespace name 'FrmReg1' could not be found
(are you missing a using directive or an assembly reference?)
Niradhip ChakrabortyPosted Apr 10, 2008, 1:38 AM
Code for the value of one text box on form1 to another textbox on form 2
example:
:
There are 2 forms
form1 and form 2
onclick event of button1 on form1 write this code
private void button1_click()
{
form2 xx=new form2();
//this will contain value of textbox1 on form1
//Tag value is int by default we have to convert into string
xx.Tag=textBox1.Text;
xx.Show();
}
//now form2 coding
private void form2_load()
{
//showing value of Textbox1 on form2 text box
textBox2.Text=Convert.ToString(this.Tag);
}