random string

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • andrew4862
    New Member
    • Oct 2006
    • 13

    random string

    I want to make it so that on a click event a random news article shows picked from a list of articles. Can some one tell me how i would go about codeing this?
    Do i need to make a module containing the articles?
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Originally posted by andrew4862
    I want to make it so that on a click event a random news article shows picked from a list of articles. Can some one tell me how i would go about codeing this?
    Do i need to make a module containing the articles?
    Hi, this is a generic method that you can fit into your own coding. You can store your articles in text files and load them individually into an array
    Code:
    Dim arNews(5) As String
    Dim intArticle As Integer
    Dim stArticle As String
    
    'populate the array with articles from different text files
    
    Randomize
    intArticle = CInt(Rnd() * UBound(arNews))
    stArticle = arNews(intArticle)

    Comment

    Working...