Results 1 to 7 of 7

Thread: How can I store multiple values using single button in C#

  1. #1
    Join Date
    Jan 2011
    Posts
    37

    How can I store multiple values using single button in C#

    Hello everyone. I am second year computer science student. Recently I got one assignment of creating one application similar to calculator. I already start this application. My main aim is to provide the facility of performing multi number operations. My problem is whenever I press single button the test associated with that appears on textbox, but when I press the second one instead of appending the previous number it replaces the original one. I don’t know how to solve this problem. I desperately need someone’s help for get rid of this problem. I would like to say thanks in advance for all your valuable and precious replies. Oh! I forget to tell you about language. Actually I am using c# as my coding language under .net frameworks 3.5 environment.

  2. #2
    Join Date
    May 2009
    Posts
    637

    Re: How can I store multiple values using single button in C#

    Hi! I am first year BCA student. I loved to gather information about new languages which will be helpful for my future. This year I am also going to learn the same language. I discuss your problem with my seniors, they suggest me one solution to tell you. I hope this will help you get rid of this problem. They told me to suggest you to use the concept of concatenation for solving this problem. It is quite easy to concatenate one value to other. The code that you have use to achieve this is as follow:-
    Code:
    TextBoxName.Text += Button.Text;

  3. #3
    Join Date
    May 2009
    Posts
    511

    Re: How can I store multiple values using single button in C#

    The solution for your problem you are currently talking about is really simplest one. I don’t think so the concept of concatenation wills relly going to help you to solve your query. The main purpose of concatenation is adding one digit of alphabet next to previous one. This concept is not much helpful in not useful for making applications like calculator. I will suggest you to use different option that is, one you enter value inside textbox store that value inside particular variable. This will help you to store single digit at a time but using the same button.

  4. #4
    Join Date
    May 2009
    Posts
    543

    Re: How can I store multiple values using single button in C#

    There are number of ways available for constructing calculator type applications. I will suggest you to start your application by focusing on basic fundamental principles of the calculator. First try to apply all your functionality to single digit only. I have one suggestion to solve your problem. That is before clicking on operation buttons just keep on adding the all the digits using the concept of concatenation. Once you click on the operation buttons like adding, subtracting etc. store that value inside one variable. After clicking on that button turn that text box empty and allow the user to enter numbers and repeat the same procedure that you use with previous number. You can use the same procedure for all the type of operations.

  5. #5
    Join Date
    May 2009
    Posts
    529

    Re: How can I store multiple values using single button in C#

    I think the concept of switch condition will definitely help you to solve your problem. I hope you already know how to use switch condition in c#. Once you enter the digit inside textbox store that particular value inside one object of the same type. After doing that for checking which operation you have to perform on those numbers that you store. I am not expert in c#. I already forward your problem to my engineer friends. I hope they will get back to you as soon as possible.

  6. #6
    Join Date
    Apr 2009
    Posts
    569

    Re: How can I store multiple values using single button in C#

    Yesterday at the time of reading books I come around one code that will really help you. Due to large amount of code I am not able to tell you all about that code. But you can easily download that book from internet. This book is really helpful for all the beginners as well as for all the experience persons using this language. I hope this will also help you to get rid of this problem.

  7. #7
    Join Date
    Apr 2009
    Posts
    569

    Re: How can I store multiple values using single button in C#

    If you want to perform multi number operation than I don’t think so normal data types will help you to achieve desired result simply use the option of arrays for doing such kind of operations. Array will simplify your all the problems related to arithmetic operations and all that. If you want to get more information about that, then I will suggest you to use PDF files available on internet. This contains every single line of code that you want to implement in your project to get desired result.

Similar Threads

  1. EXCEL Lookup the same value that has multiple values
    By horse43 in forum Windows Software
    Replies: 1
    Last Post: 09-06-2012, 11:42 AM
  2. How to get multiple values of Vlookup in Single Cell
    By Henriksen in forum MS Office Support
    Replies: 4
    Last Post: 25-02-2012, 11:02 AM
  3. PHP method to import multiple values
    By joal123 in forum Software Development
    Replies: 4
    Last Post: 28-01-2010, 10:43 PM
  4. php return multiple values
    By Aston5 in forum Software Development
    Replies: 2
    Last Post: 29-06-2009, 10:14 PM
  5. Excel : vlookup multiple values
    By Laler in forum Windows Software
    Replies: 3
    Last Post: 25-06-2009, 10:27 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,542,363.27543 seconds with 17 queries