Results 1 to 3 of 3

Thread: [RESOLVED] ID elements in an array

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    10

    Resolved [RESOLVED] ID elements in an array

    Dear All,
    Code:
    Private Sub Form_Load()
    
    Dim i As Integer
    For i = 1 To 30
    List1.AddItem (i)
    Next
    
    End Sub
    
    Private Sub SetupDatasets()
    
     Dim i As Integer
     
    Dim objDataset As Dataset
    
       Set objDataset = Graph1.Datasets.Add
        
        With objDataset
            .Visible = False
            .ShowPoints = True
            .ShowLines = True
            .ShowBars = False
            .ShowCaps = False
            .LineColor = RGB(0, 0, 255)
            .PointColor = RGB(150, 150, 255)
             
        End With
      
        For i = 0 To List1.ListCount - 1
        objDataset.Points.Add CInt(List1.List(i))
        Next i
    
    end sub
    I have Listbox with 30 entries (values).

    How do I use only the first 10 entries. Discard the last 20 entries?

    Likewise, how do I discard the first 20 entries and use the last 10 entries?

    TIA

  2. #2
    Just a Member! seenu_1st's Avatar
    Join Date
    Aug 2007
    Location
    India
    Posts
    2,170

    Re: ID elements in an array

    Code:
    For i = 0 To 9 '1st 10 entries
        objDataset.Points.Add CInt(List1.List(i))
    Next i
    Code:
    For i = 20 To List1.ListCount - 1 'last 10 entries
        objDataset.Points.Add CInt(List1.List(i))
    Next i
    i m not sure that u want like this.
    Seenu

    If this post is useful, pls don't forget to Rate this post.
    Pls mark thread as resolved once ur problem solved.
    ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms


  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    10

    Re: ID elements in an array

    Thank you - quite easy!

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