Results 1 to 7 of 7

Thread: [RESOLVED] [02/03] Need help on simple looping...

  1. #1

    Thread Starter
    Hyperactive Member shyguyjeff's Avatar
    Join Date
    Jul 2007
    Location
    City of Durian
    Posts
    289

    Resolved [RESOLVED] [02/03] Need help on simple looping...

    Elow everyone...it's meh again, i just need a help from those who had kind heart there on how to loop and put it on the textbox...yhe format would be like this..:

    on my code i only got the first column loop but how can i do this to other loop this is my code

    Code:
     Dim i As Integer
    
                For i = 1 To term
                    ListView2.Items.Add(i)
                Next

    Terms = 12
    Date = Now - 12 (MMM)
    Monthly = 125

    Terms = 12 Code:
    1. Terms              Date                        Payment             Payment made
    2. 1                  March                         125       
    3. 2                  February                      125       
    4. 3                  January                       125       
    5. 4                  December                      125
    6. 5                  November                      125
    7. 6                  October                       125
    8. 7                  September                     125
    9. 8                  August                        125
    10. 9                  July                          125                   125
    11. 10                 June                          125                   125
    12. 11                 May                           125                   125
    13. 12                 April                         125                   125

    This value will be put on textbox...
    Payment made: 500 March:125 February: 125 January: 750 Total Due: 1000


    Thanks in advance guys...
    Last edited by shyguyjeff; Mar 26th, 2008 at 03:56 AM.

  2. #2
    Fanatic Member
    Join Date
    Feb 2007
    Location
    Eindhoven
    Posts
    828

    Re: [02/03] Need help on simple looping...

    where the information about the payment coming from? a database? a text file? an XML document?

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [02/03] Need help on simple looping...

    vb.net Code:
    1. Dim termCount As Integer = 12
    2. Dim items(termCount - 1) As ListViewItem
    3.  
    4. For index As Integer = 0 To items.GetUpperBound(0) Step 1
    5.     items(index) = New ListViewItem(New String() {(index + 1).ToString(), _
    6.                                                    Date.Now.AddMonths(-index).ToString("MMM"), _
    7.                                                    (125).ToString("c"), _
    8.                                                    String.Empty})
    9. Next index
    10.  
    11. Me.ListView1.Items.AddRange(items)
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Hyperactive Member shyguyjeff's Avatar
    Join Date
    Jul 2007
    Location
    City of Durian
    Posts
    289

    Re: [02/03] Need help on simple looping...

    from monthly...There is a value on it...the monthly there stands for payments...

  5. #5

    Thread Starter
    Hyperactive Member shyguyjeff's Avatar
    Join Date
    Jul 2007
    Location
    City of Durian
    Posts
    289

    Re: [02/03] Need help on simple looping...

    tnx jm...it is the one i am looking for...i will try that sample...again thank you...thank you....thank you jm...

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [02/03] Need help on simple looping...

    Hmmm... didn't read the last couple of lines properly. Split the string on the colons, then split each substring on spaces. You'll end up with a pair of strings for each month where one is the amount paid and the other is the month. You could put them in a Hashtable and then instead of using String.Empty as I did in my code you could get the payment value from the Hashtable.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Hyperactive Member shyguyjeff's Avatar
    Join Date
    Jul 2007
    Location
    City of Durian
    Posts
    289

    Re: [RESOLVED] [02/03] Need help on simple looping...

    ok jm i can do that already...Thanks again jm..God Bless and have a nice day...

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