HI all,
My first post ever os giv me some feedback plz.
I have one form(main form) which when i click on a button opens another form(table form), in this form
the user presses a button and i want to send the text from this button back to the other form(main form).
I tried creating a new instance of the main form but that didn't work. I also tried creating a public class with
a public string to store it in but i have to create a new instance of this class in each form, meaning i cant get the data i want.
Very frustrating >_<
Main Form:
private
void tableForm()
{
FormTables TableForm = new FormTables();
TableForm.Show();
}
Table form:
FormDetails
detailsForm = new FormDetails();
private
void loadTables()
{
for (int i = 1; i < 31; i++)
{
Button buttontables = new Button();
buttontables.Size =
new System.Drawing.Size(86, 71);
buttontables.UseVisualStyleBackColor =
true;
buttontables.Text = i.ToString();
buttontables.Click +=
new System.EventHandler(this.buttonTables_Click);
flowLayoutPanel1.Controls.Add(buttontables);
}
}
private
void buttonTables_Click(object sender, EventArgs e)
{
Button clickedButton = (Button)sender;
detailsForm.Table = clickedButton.Text;
//dont know how to send it back to the main form...
}
public
class FormDetails
{
string table;
public string Table
{
get { return table; }
set { table = value; }
}
}