Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. incrementing using C#.Net

incrementing using C#.Net

Scheduled Pinned Locked Moved C#
csharphelp
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    varun_mca_ju 0
    wrote on last edited by
    #1

    i have a C# windows application in which i have a button PRINT .On clicking the button, data from textboxes is taken and inserted into particular cells of an MS Excel sheet. I have a textbox BILL NO. and i want that every time i click the PRINT button the value in BILL NO.textbox should be incremented so that it can be inserted into a particular cell of MS Excel sheet. for e.g. if i have entered 0 in the BILL NO. textbox,everytime i click the PRINT button the text in the textbox should be incremented to 1,2,3....and so on. i have tried a few options ...but whenever i run the application the count starts from 0......PLZ. HElp :(

    C 1 Reply Last reply
    0
    • V varun_mca_ju 0

      i have a C# windows application in which i have a button PRINT .On clicking the button, data from textboxes is taken and inserted into particular cells of an MS Excel sheet. I have a textbox BILL NO. and i want that every time i click the PRINT button the value in BILL NO.textbox should be incremented so that it can be inserted into a particular cell of MS Excel sheet. for e.g. if i have entered 0 in the BILL NO. textbox,everytime i click the PRINT button the text in the textbox should be incremented to 1,2,3....and so on. i have tried a few options ...but whenever i run the application the count starts from 0......PLZ. HElp :(

      C Offline
      C Offline
      C1AllenS
      wrote on last edited by
      #2

      Hello, If I understand correctly, you want that each time application is started, the value in the TextBox should be incremented for the last value that was used. Well if thats the case then you will have to store the value each time the application is closed and then read it back again into the text box and increment the value. I hope this helps.

      Allen Smith ComponentOne LLC www.componentone.com

      V 1 Reply Last reply
      0
      • C C1AllenS

        Hello, If I understand correctly, you want that each time application is started, the value in the TextBox should be incremented for the last value that was used. Well if thats the case then you will have to store the value each time the application is closed and then read it back again into the text box and increment the value. I hope this helps.

        Allen Smith ComponentOne LLC www.componentone.com

        V Offline
        V Offline
        varun_mca_ju 0
        wrote on last edited by
        #3

        [Message Deleted]

        V A 2 Replies Last reply
        0
        • V varun_mca_ju 0

          [Message Deleted]

          V Offline
          V Offline
          varun_mca_ju 0
          wrote on last edited by
          #4

          thanks for the reply Allen :) ...that's exactly what i wanted....i am new to .net programming so could you please give me a hint as to how i can store the value each time the application is closed and then read it back again into the text box and increment the value.

          1 Reply Last reply
          0
          • V varun_mca_ju 0

            [Message Deleted]

            A Offline
            A Offline
            Ashfield
            wrote on last edited by
            #5

            It all depends on what yuo have available. It really ought to be stored in a single location accessable to ANY user to avoid duplication.

            Bob Ashfield Consultants Ltd

            V 1 Reply Last reply
            0
            • A Ashfield

              It all depends on what yuo have available. It really ought to be stored in a single location accessable to ANY user to avoid duplication.

              Bob Ashfield Consultants Ltd

              V Offline
              V Offline
              varun_mca_ju 0
              wrote on last edited by
              #6

              thanks for the reply Ashfield...but i am new to C# programming...could you please give me a hint as to how to do it?

              A 1 Reply Last reply
              0
              • V varun_mca_ju 0

                thanks for the reply Ashfield...but i am new to C# programming...could you please give me a hint as to how to do it?

                A Offline
                A Offline
                Ashfield
                wrote on last edited by
                #7

                As I said, it all depends on what you have available. For example, it could be stored in a database table (along with all the other details), or it could be something as simple as a file located on a network share. Without knowing your system I really cannot say.

                Bob Ashfield Consultants Ltd

                V 1 Reply Last reply
                0
                • A Ashfield

                  As I said, it all depends on what you have available. For example, it could be stored in a database table (along with all the other details), or it could be something as simple as a file located on a network share. Without knowing your system I really cannot say.

                  Bob Ashfield Consultants Ltd

                  V Offline
                  V Offline
                  varun_mca_ju 0
                  wrote on last edited by
                  #8

                  Thanks Ashfield. What i want is that on clicking a button PRINT the data in the BILL NO. textbox should be incremented and entered into a particular field of a database. I know how to enter the data from the textbox to the database . But the problem is that if i have entered 0 in the BILL NO. textbox and click the PRINT button, 1 is entered into the database field but when i close the application and run it again, the increment again starts from 0. I want that if the value in the textbox was 1 when the application was last run...it should be incremented to 2 when i run the application this time . i think i have made myself clear...but if u need any more background plz let me know...thanks for giving me the time

                  A 1 Reply Last reply
                  0
                  • V varun_mca_ju 0

                    Thanks Ashfield. What i want is that on clicking a button PRINT the data in the BILL NO. textbox should be incremented and entered into a particular field of a database. I know how to enter the data from the textbox to the database . But the problem is that if i have entered 0 in the BILL NO. textbox and click the PRINT button, 1 is entered into the database field but when i close the application and run it again, the increment again starts from 0. I want that if the value in the textbox was 1 when the application was last run...it should be incremented to 2 when i run the application this time . i think i have made myself clear...but if u need any more background plz let me know...thanks for giving me the time

                    A Offline
                    A Offline
                    Ashfield
                    wrote on last edited by
                    #9

                    Well, if you enter the Bill No in a database, at the start of the program select the maximum bill no from the database and use that as your starting number rather than zero, and do not let the user enter it manually. Hope this helps, its fairly normal practice.

                    Bob Ashfield Consultants Ltd

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups