Sub Delay(ByVal dblSecs As Double)

        Const OneSec As Double = 1.0# / (1440.0# * 60.0#)
        Dim dblWaitTil As Date
        Now.AddSeconds(OneSec)
        dblWaitTil = Now.AddSeconds(OneSec).AddSeconds(dblSecs)
        Do Until Now > dblWaitTil
            Application.DoEvents() ' Allow windows messages to be processed
        Loop

    End Sub
    Function randomtime() As Integer
        Dim min As Integer = TextBox9.Text
        Dim max As Integer = TextBox10.Text

        Dim final As Integer = GetRandom.Next(max - min) + min
        Label9.Text = final
        Return final
    End Function

'then use Delay(randomtime())