CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2005
    Posts
    4

    Question Real beginner in here

    I am just helping out someone here and am looking for a simple code for a church to give out receipts for donations. What they require is the code to generate a new receipt number then the next number and so on. So for the first receipt it would be #1 then next it would be #2. I am helping them with their accounting and Simply lets me code in VB to create a receipt form in Crystal reports. I am sorry I know nothing of the syntax and have gone through books that friends have given me to find the simple code to start this going. Any kind help would be greatly appreciated. As you can tell this a voluntary thing.

    Thanks and your kind consideration is greatly appreciated.

  2. #2
    Join Date
    Nov 2005
    Posts
    36

    Re: Real beginner in here

    Some more information would be fantastic.

    Like what else is in your form, is it say like two textboxes and a button.

    One TextBox for Donation amount, and one for Receipt Number
    and then maybe a print button or something??

    If your case is something like that then you could:

    Code:
    'in general declarations
    Dim ReceiptNumber as Integer
    
    Private Sub cmdPrint_Click()
         ReceiptNumber = ReceiptNumber + 1
         txtboxRNum = ReceiptNumber
    end sub
    Also, if your not always running this program, and well probably a good idea anyway, you could store this number in a text file.
    Code:
    Open "ReceiptNumber.txt" For Output As #1
          Print #1, ReceiptNumber
    Close #1
    
    'and to bring it in on load
    Private Sub Form_Load()
    Open "ReceiptNumber.txt" For Input As #1
         Line Input #1, ReceiptNumber
    Close #1
    
    txtboxRNum = ReceiptNumber
    
    End Sub
    I hope this helps at least some.

  3. #3
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: Real beginner in here

    Quote Originally Posted by pamela
    ...code in VB to create a receipt form in Crystal reports...
    There is a special Forum here for Crystal reports. IMHO this maybe is more a Crystal Report project as you described it. Or it is a mixed one. But I could imagine that your problem to put numbers in that Form which adds up automatically is maybe a thing easier done in Crystel Reports itself. But its only my opinion, because I never tried Crystal Reports. So as a hint: additional ask there
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured