Results 1 to 5 of 5

Thread: After a control is loaded at runtime...

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    5

    After a control is loaded at runtime...

    OK, I've looped through a text file and loaded a timer control with names of which are in the text file, works fine. But after the control is loaded, I want it to increase a variable by 1. How would I do this? Or is it possible? Thanks!

  2. #2
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Fort Worth, Texas, USA
    Posts
    264
    Variable = Variable + 1

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    5
    Originally posted by Ken Whiteman
    Variable = Variable + 1
    I know that.
    But, I want to make the timer I loaded at runtime increase the variable by 1......possible? Or am I just over looking something?

  4. #4
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Fort Worth, Texas, USA
    Posts
    264
    If you have loaded a timer at runtime, then it should have an index of 0.

    Use the Timer event under that index to do the job.

    Timer1_Timer(Index as Integer)

    if index = 1 then
    Variable = Variable + 1
    end if

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    5
    Originally posted by Ken Whiteman
    If you have loaded a timer at runtime, then it should have an index of 0.

    Use the Timer event under that index to do the job.

    Timer1_Timer(Index as Integer)

    if index = 1 then
    Variable = Variable + 1
    end if
    I'm sorry. I do not understand...
    I'm making a MUD(text game) and I want a timer with the name I just created here:
    Code:
    Sub AddTimers(FileName As String)
        Dim lstInput As String
        On Error Resume Next
        Open FileName$ For Input As #1
        While Not EOF(1)
            Input #1, lstInput$
            'DoEvents
            Set Control = Controls.Add("VB.timer", ReplaceText(lstInput$, " ", "") + "HP")
        With Control
           .Enabled = True
           .Interval = 1000
        End With
        Wend
        Close #1
    End Sub
    
    '<---Add the timers at run time with names in users.txt--->
    Private Sub Form_Load()
    FormOnTop Me.hwnd, True
    Call AddTimers("C:\Rag\users.txt")
    End Sub

    ...to raise a variable (HP, or Life) 1 per second.
    Maybe I'm not very clear? Sorry my english is bad...

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