When i click the button i want to assign the textbox value from another class.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication2 { public partial class Form1 : Form { Download myDownload = new Download(); static string textBoxString; public Form1() { InitializeComponent(); } public static string TextboxText { set { textBoxString = value; } } private void button1_Click_1(object sender, EventArgs e) { myDownload.Do(); textBox1.Text = textBoxString; textBox1.Invalidate(); } } public class Download { public void Do() { Form1.TextboxText = "My text"; } } }
interface IYourForm { string FirstName { get; set; } }
class YourFormClass : Form, IYourForm { // lots of other code here public string FirstName { get { return firstNameTextBox.Text; } set { firstNameTextBox.Text = value; } } }
class SomeClass { private readonly IYourForm form; public SomeClass(IYourForm form) { this.form = form; } // and so on }
0 comments
Post a Comment