Results 1 to 5 of 5

Thread: Changing Text Code

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    2

    Exclamation

    Hi i am in need of a code so that i can have text changing similar to in installers and in dos when u r formating
    eg. like 1% then go to 10% but on the same line overwriting each other, like when u r installing and it shows your progress!!
    i want to make a fake format and need this code to complete it
    thank you
    ryanchu

  2. #2
    Member
    Join Date
    May 2000
    Location
    Canada
    Posts
    52
    They just update the caption of a label. Try this out.
    On a form put a timer and a label. Paste the folowing code
    VB Code:
    1. Option Explicit
    2. Dim x As Integer
    3.  
    4. Private Sub Form_Load()
    5. Label1 = ""
    6. Timer1.Interval = 100
    7. Timer1.Enabled = True
    8. End Sub
    9.  
    10. Private Sub Timer1_Timer()
    11. x = x + 1
    12. If x = 100 Then
    13. Timer1.Enabled = False
    14. Label1 = "Format Complete"
    15. Exit Sub
    16. End If
    17. Label1 = x & " % Formated"
    18.  
    19. End Sub



  3. #3
    Guest
    You don't need a timer. Just use the For...Next Statement.

    Code:
    Private Sub Command1_Click()
         For i = 0 To 100
         DoEvents
              Label1.caption = i
         If i = 100 Then
              MsgBox "done"
         End If
         Next i
         Label1.caption = i & "% formatted!"
    End Sub

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    2

    ????

    Sorry im a beginner so i dont understand!!!
    here is what i have so far, can u please fix it up as i dont know what u r talkin about

    Private Sub cmdStart_Click()
    Let aname = InputBox$("Please Enter Your Name")
    delay5
    frmMain.Print "Okay "; (aname); " We Are Gonna Play A Little Game!!"
    delay2
    x = MsgBox("Do You Want To Play??", vbYesNo)
    delay3
    If x = vbYes Then MsgBox "Good, Im Glad You Want To Play!!"
    If x = vbNo Then MsgBox "Too Bad, We Are Gonna Play Anyway!!"
    delay3
    MsgBox "Okay Let's Begin Then"
    delay3
    MsgBox "First of all lets perform a test to see how much free space you have left on your hardrive"
    delay3
    frmMain.Print "Testing.........."
    delay
    frmMain.Print "Testing Complete"
    delay2
    frmMain.Print "Reading Results...."
    delay2
    c = MsgBox("Oh Dear!!! It seems that your hard drive is a bit full!!, I know i'll give it a clean for you!!, Is That Okay??", vbYesNo)
    delay3
    If c = vbYes Then MsgBox "Good, This should clear up your hard drive a bit"
    If c = vbNo Then MsgBox "Too Bad!!!!!, I'm gonna do it anyway"
    delay2
    frmMain.Print "C:\Format C:"
    delay2
    frmMain.Print "WARNING, ALL DATA THIS DRIVE (C WILL BE LOST"
    frmMain.Print "Proceed with Format (Y/N)?"
    delay4
    frmMain.Print "Yes"
    delay2
    frmMain.Print "Format Commencing......."

    THIS IS WERE IT MUST HAVE IT COUNTING

    End Sub

    Private Sub delay()
    For Number = 1 To 7000000
    Next
    End Sub

    Private Sub delay2()
    For Number = 1 To 3000000
    Next
    End Sub

    Private Sub delay3()
    For Number = 1 To 1500000
    Next
    End Sub

    Private Sub delay4()
    For Number = 1 To 5000000
    Next
    End Sub

    Private Sub delay5()
    For Number = 1 To 2000000
    Next
    End Sub

    thanx for your help

  5. #5
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Ok here we go, put a progressbar on your form (you can find them in the Microsoft Common Controls)

    Code:
    Private Sub cmdStart_Click() 
    Let aname = InputBox$("Please Enter Your Name") 
    delay5 
    frmMain.Print "Okay "; (aname); " We Are Gonna Play A Little Game!!" 
    delay2 
    x = MsgBox("Do You Want To Play??", vbYesNo) 
    delay3 
    If x = vbYes Then MsgBox "Good, Im Glad You Want To Play!!" 
    If x = vbNo Then MsgBox "Too Bad, We Are Gonna Play Anyway!!" 
    delay3 
    MsgBox "Okay Let's Begin Then" 
    delay3 
    MsgBox "First of all lets perform a test to see how much free space you have left on your hardrive" 
    delay3 
    frmMain.Print "Testing.........." 
    delay 
    frmMain.Print "Testing Complete" 
    delay2 
    frmMain.Print "Reading Results...." 
    delay2 
    c = MsgBox("Oh Dear!!! It seems that your hard drive is a bit full!!, I know i'll give it a clean for you!!, Is That Okay??", vbYesNo) 
    delay3 
    If c = vbYes Then MsgBox "Good, This should clear up your hard drive a bit" 
    If c = vbNo Then MsgBox "Too Bad!!!!!, I'm gonna do it anyway" 
    delay2 
    frmMain.Print "C:\Format C:" 
    delay2 
    frmMain.Print "WARNING, ALL DATA THIS DRIVE (C WILL BE LOST" 
    frmMain.Print "Proceed with Format (Y/N)?" 
    delay4 
    frmMain.Print "Yes" 
    delay2 
    frmMain.Print "Format Commencing......." 
    
    'THIS IS WERE IT MUST HAVE IT COUNTING 
    'THIS IS THE COUNTING!
    Progressbar1.Max = 10000000
    For Number = 1 to 10000000 'any number you want but formatting takes long.
    Progressbar1.Value = Number
    DoEvents 'Really Important!
    Next Number
    'END OF THE COUNTING!
    End Sub 
    
    Private Sub delay() 
    For Number = 1 To 7000000 
    Next 
    End Sub 
    
    Private Sub delay2() 
    For Number = 1 To 3000000 
    Next 
    End Sub 
    
    Private Sub delay3() 
    For Number = 1 To 1500000 
    Next 
    End Sub 
    
    Private Sub delay4() 
    For Number = 1 To 5000000 
    Next 
    End Sub 
    
    Private Sub delay5() 
    For Number = 1 To 2000000 
    Next 
    End Sub
    [Edited by Jop on 10-28-2000 at 09:14 AM]
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

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