0

guys can anyone help me, I want to display an amount on a textbox when I debug my program.

For example I have textbox1, I want textbox1 to display the amount that I assigned to it which is 100,
but I cannot make it show up in the textbox1 when I run my program. what do you think is wrong with my code below:

 private void fundsTextbox_TextChanged(object sender, EventArgs e)
        {

            Compute comp = new Compute();
            comp.Funds = fundsTextbox.Text;
            int fundsAmount = Convert.ToInt32(fundsTextbox.Text);

            fundsAmount = 100;

            fundsTextbox.Text = fundsAmount.ToString();


        }
4
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by Momerath
0

At the start of the program? You want the textbox to display an amount? Place the code in a main method, the form class constructor, or a method the constructor calls, not in the textchanged method. If that's not what you mean, please explain more.

0

The TextChanged event only occurs when you do what it says : "change text in a texbox"
Add this code in your init methods: fundsTextbox.Text = "100";

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.