locked
C # windows formu RRS feed

  • Question

  • Hello friends, I want to make a simple application, but there is a place where I hang out.

    There will be one TextBox, it is not known how many data to input each time I enter the data and press the plus. I will finally write it in another textbox. He writes each number I enter (when I press plus) in the result textbox but does not collect each other.



    • Edited by rmys Wednesday, August 5, 2020 3:21 PM
    • Moved by CoolDadTx Wednesday, August 5, 2020 6:03 PM Winforms related
    Wednesday, August 5, 2020 2:52 PM

All replies

  • Hello,

    This is an English speaking forum, please translate your question to English.

    perhaps this is it

    Hello friends, I want to make a simple application, but there is a place where I hang out.

    There will be one TextBox, it is not known how many data to input each time I enter the data and press the plus. I will finally write it in another textbox. He writes each number I enter (when I press plus) in the result textbox but does not collect each other.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange


    Wednesday, August 5, 2020 2:56 PM
  • Hi rmys, 
    >>it is not known how many data to input each time I enter the data and press the plus. I will finally write it in another textbox. 
    According to my understanding, do you want to add each value entered in the textbox by clicking the plus.
    If not, please explain it in detail and provide some code to reproduce it.
    If so, please refer to the following code example:

    int result;
    int sum = 0;
    private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
    {
        if (e.KeyChar == '+')
        {
    
            if (int.TryParse(textBox1.Text, out result))
            {
                sum = sum + result;
                textBox2.Text = sum.ToString();
            }
        }
    }

    Best Regards,
    Daniel Zhang


    "Windows Forms General" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Windows Forms General" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Thursday, August 6, 2020 8:06 AM
  • Are you saying you need to enter data into one textbox and then put each line together in another textbox?

    The translation says but does not collect each other and that is not clear. Are you saying that the program is working except it is not being combined into the output textbox properly? Can you describe that more? What happens or does not happen that should not or should?

    Does the program need to accept multiple lines at once and then transfer them to the other textbox when the add button is pushed or do you need to add one line at a time? For example if you had:

    Line one
    Line two
    Last line

    Then would (could) the add button be pushed only once or does it need to be pushed three times?



    Sam Hobbs
    SimpleSamples.Info


    Friday, August 7, 2020 7:40 PM
  • Hi rmys,
    Has your problem been solved? If it is resolved, we suggest that you mark it as the answer. So it can help other people who have the same problem find a solution quickly. If not solved, what problem did you encounter?
    Best Regards,
    Daniel Zhang


    "Windows Forms General" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Windows Forms General" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Wednesday, August 12, 2020 9:31 AM
  • Hi rmys,
    How is your problem progressing? If the solution provided solves your problem, please mark it as an answer.
    Best Regards,
    Daniel Zhang


    "Windows Forms General" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Windows Forms General" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Friday, August 28, 2020 2:10 AM