generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

(Visual Basic) What is wrong with this?

Previous Thread :: Next Thread 
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
07 Nov 2011 04:24 PM
I'm making this program that times me on how long I use the computer. When I enter my time into the correct TextBox and click the button to start my time, the form just freezes. Why is this happening? Here is my code:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Public Class Form1
        Private word As String
        Private defTime As Integer
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            word = "cows"
            defTime = 0.1 * 60000
            Button1.Text = "Time Started"
            Threading.Thread.Sleep(1000)
            Button1.Text = "Start Time"
            Threading.Thread.Sleep(Minutes.Text * 60000)
            Label2.Visible = True
            Threading.Thread.Sleep(500)
            Label2.Visible = False
            Threading.Thread.Sleep(500)
            Label2.Visible = True
            Threading.Thread.Sleep(500)
            Label2.Visible = False
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            If wrd.Text = word Then
                Threading.Thread.Sleep(defTime)
                Label2.Text = "EXTRA TIME IS UP!!"
                Label2.Visible = True
                Threading.Thread.Sleep(500)
                Label2.Visible = False
                Threading.Thread.Sleep(500)
                Label2.Visible = True
                Threading.Thread.Sleep(500)
                Label2.Visible = False
            End If
        End Sub
    End Class
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
07 Nov 2011 04:49 PM
First of all, don't name your stuff its class name then a number. That is one of the best ways to become unorganized in large projects, and I learned that the hard way.

Second, you need to use Dim to declare a local variable. For example:

word = "cows"
defTime = 0.1 * 60000

should be:

Dim word = "cows"
Dim defTime = 0.1 * 60000
Report Abuse
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
07 Nov 2011 05:07 PM
Ok, cool. I only made it like that because I googled how to use variables :3
Report Abuse
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
07 Nov 2011 05:38 PM
Ok, here's new script;

    Public Class Form1
        Dim word = "cows"
        Dim defTime = 0.1 * 60000
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Button1.Text = "Time Started"
            Threading.Thread.Sleep(1000)
            Button1.Text = "Start Time"
            Threading.Thread.Sleep(Minutes.Text * 60000)
            Label2.Visible = True
            Threading.Thread.Sleep(500)
            Label2.Visible = False
            Threading.Thread.Sleep(500)
            Label2.Visible = True
            Threading.Thread.Sleep(500)
            Label2.Visible = False
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            If wrd.Text = word Then
                Threading.Thread.Sleep(defTime)
                Label2.Text = "EXTRA TIME IS UP!!"
                Label2.Visible = True
                Threading.Thread.Sleep(500)
                Label2.Visible = False
                Threading.Thread.Sleep(500)
                Label2.Visible = True
                Threading.Thread.Sleep(500)
                Label2.Visible = False
            End If
        End Sub
    End Class
Report Abuse
DXPower is not online. DXPower
Joined: 21 Oct 2008
Total Posts: 2866
07 Nov 2011 05:59 PM
Is this even LUA!
Report Abuse
ultralegomaster5096 is not online. ultralegomaster5096
Joined: 17 Jan 2011
Total Posts: 4351
07 Nov 2011 06:04 PM
Does it have to be?

~Death to lazy builders. Remove the CFrame tools. Command bar all the way. -pauljkl
Report Abuse
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
07 Nov 2011 06:05 PM
@DX

I am implying you have not read the first 14 characters of the title.
Report Abuse
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
07 Nov 2011 06:24 PM
bump
Report Abuse
rotototo is not online. rotototo
Joined: 14 Sep 2008
Total Posts: 2390
07 Nov 2011 06:28 PM
Well done I suppose.

I'm taking a class on VB, but I'm not THAT advanced!
Report Abuse
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
07 Nov 2011 06:29 PM
It's always been a wonder why people post on threads just to state things that nobody care about.
Report Abuse
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
07 Nov 2011 06:37 PM
bump
Report Abuse
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
07 Nov 2011 06:56 PM
bump

i need an answer
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
07 Nov 2011 07:59 PM
What's wrong with the new script?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image