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();


Recommended Answers

All 3 Replies

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.

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";

You can also go to the text box properties in Visual Studio and set the Text property to "100".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.