17
Answers

Using UserControl textBox value in Form

Ask a question
billypostman

billypostman

14y
9.7k
1
Hi,

I have a calculator.cs (it is an userControl). I'm using it in the file iskonto.cs named which is windows form. When the calculator's textbox changed, i want to use the textbox value in iskonto.cs... Please help me with this issue. Here is my code;

calculator.cs

iskonto indirim = new iskonto();
private void txtResult_TextChanged(object sender, EventArgs e)
        {          
            indirim.iskontoGoster(txtResult.Text.ToString());
        }


iskonto.cs

public void iskontoGoster(string textBoxValue)
        {
            if (textBoxValue != null || textBoxValue != "")
            {
                button1.Text = "% " + textBoxValue + " iskonto yap. Sonuç = ";
                button1.BackColor = System.Drawing.Color.Navy;
                button1.ForeColor = System.Drawing.Color.Yellow;
            }
        }


Answers (17)