How to assign textbox value to another class in wpf

Димитър Грудев

I try to assign textbox value to another class, but I do only this in main class :

public string TextBox1Text
{   
    get { return textBox1.Text; } 
    set { textBox1.Text = value; } 
}

How can I assign this value in second class?

Mong Zhu

create the same property in the second class and pass it over in the main class:

public class SecondClass
{
    public string TextBox1Text {  get; set; }
}

public class MainClass
{
    SecondClass sc = new SecondClass();


    public string TextBox1Text
    {   
        get { return textBox1.Text; } 
        set { textBox1.Text = value; } 
    }


    public MainClass
    {   
        sc.TextBox1Text = this.TextBox1Text;
    }
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Assign value of a class to another class

How do I store textbox name reference in a Variable to later assign the value of that textbox to another variable

How to assign value from one data class to another data class

bind a value having dependency property from one class to another class textbox control in wpf

Assign value to a list of another class

How to assign a value to class member from another form in C#?

How to assign a value selected from a Picker to a variable in another class?

Assign static value to class from another class

How do I assign a var value to a textbox?

How to assign a time value from a textbox to a variable?

How to randomly assign value to textbox onload

How to assign a value to a textbox at program start

How to get value from one textbox and assign to next coming textbox

How to assign to a list from another method in WPF?

Using scanner to assign value to a variable in another class?

How to assign an object of a class to a value

How to assign value to class properties?

WPF TextBox - how to stop width change with value

how to automatically set value of textbox according to value of another textbox

How to set a TextBox value when another TextBox value is changed

How to get value of textbox on button click on one form and into a string in another class?

how to assign value class within class property

How to Display value of textbox in label in another form?

how to get the value of category and then displays it in another textbox

How do I Change or Assign a Value to a Private Variable JTextField from another class?

how to set a textbox readonly in table in jdeveleper based on another textbox value?

How to pass textbox value from a page into a textbox in another page?

How to select textbox value and move to the another textbox using selenium python

Swift: How to assign a class's delegate to another class in current class?