Results 1 to 4 of 4

Thread: Two rondom qustions

  1. #1

    Thread Starter
    Hyperactive Member Matt-D's Avatar
    Join Date
    Nov 1999
    Location
    Mettmann, Germany
    Posts
    305

    Arrow

    1:
    How do I use a random to get every time a different font?
    VB 3.0

    2:
    Is it possible to make a random which selects a file in
    a folder to open it (picture, text,...) ?
    VB 6.0

    Thanks for some advice, Matt-D

    [Edited by Matt-D on 10-18-2000 at 02:32 PM]

  2. #2
    Junior Member
    Join Date
    Sep 1999
    Location
    mousafah,abu-dhabi,UAE
    Posts
    29
    hi there,
    use this code for 2nd Q

    dim Rando as integer
    call dir("c:\path")
    randomize
    Rando = int ( rnd * 50)
    for i = 1 to rando
    call dir
    next i
    msgbox "c:\path\" & dir


    Ahmed Walid

  3. #3
    Guest
    Q1:

    Have a listbox hidden.

    Code:
    Function randomnumber(finished)
    Randomize
    randomnumber = Int((Val(finished) * Rnd) + 1)
    End Function
    
    Private Sub Form_Load()
    For i = 0 To Screen.FontCount - 1
    List1.AddItem (Screen.Fonts(i))
    Next i
    End Sub
    
    Private Sub Command1_Click()
    List1.ListIndex = randomnumber(List1.ListCount)
    End Sub
    
    Private Sub List1_Click()
    Text1.Font.Name = List1.Text
    End Sub


  4. #4
    Guest
    Code:
    Randomize
    Num = Int(Rnd * Screen.FontCount)
    Me.FontName = Screen.Fonts(Num)

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