This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-04-27 21:16:15

GameHutSoftware
Scratcher
Registered: 2010-04-24
Posts: 1000+

me.visible = true/false not working vb.net

this is my code:

Code:

Public Class Form1

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        'My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True).SetValue(Application.ProductName, Application.ExecutablePath)
        Me.Left = Screen.PrimaryScreen.Bounds.Width - Me.Width
        Me.Top = Screen.PrimaryScreen.WorkingArea.Height - Me.Height
        Me.TopMost = True
        TextBox1.Text = "Well, well, well. Hello there!"
        'Me.Visible = False
        Timer1.Interval = 5000
    End Sub

    Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
        If Me.Visible = False Then
            Dim RandomClassSelect As New Random()
            Dim RandomNumberSelect As Integer
            RandomNumberSelect = RandomClassSelect.Next(4)
            If RandomNumberSelect = 0 Then
                TextBox1.Text = "What kind of rodents, you ask? Capybaras."
                Me.Visible = True
                MsgBox("Rodents are gnawing at your motherboard.", MsgBoxStyle.Exclamation)
                Timer1.Interval = 5000
            End If
            If RandomNumberSelect = 1 Then
                MsgBox("Whatcha doin'?", MsgBoxStyle.Question)
            End If
            If RandomNumberSelect = 2 Then
                Timer1.Interval = 5000
                Me.Visible = True
                TextBox1.Text = "Your ignorance of me is quite annoying."
            End If
            If RandomNumberSelect = 3 Then
                TextBox1.Text = "Rickroll!"
                Me.Visible = True
                System.Diagnostics.Process.Start("http://www.scratch.mit.edu/ext/youtube/?v=oHg5SJYRHA0")
                Timer1.Interval = 5000
            End If
        End If
        If Me.Visible = True Then
            Me.Visible = False
            Dim RandomClass As New Random()
            Dim RandomNumber As Integer
            RandomNumber = RandomClass.Next(5000, 30000)
            Timer1.Interval = RandomNumber
        End If
    End Sub
End Class

for example
when RandomNumberSelect = 2 the form doesnt pop up
and when RandomNumberSelect = 3 the form pops up as the webpage opens but only for a brief moment

can anyone help?


Lurking more than posting, but still here.

Offline

 

#2 2012-04-27 21:32:18

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: me.visible = true/false not working vb.net

I have never used Me.Visible before. I always use Me.Show and Me.Hide... I can't really debug your code because I am using Ubuntu and VB.NET doesn't work on Windows DP for some reason.


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#3 2012-04-27 21:37:14

veggieman001
Scratcher
Registered: 2010-02-20
Posts: 1000+

Re: me.visible = true/false not working vb.net

nathanprocks wrote:

I have never used Me.Visible before. I always use Me.Show and Me.Hide... I can't really debug your code because I am using Ubuntu and VB.NET doesn't work on Windows DP for some reason.

Have you tried it on Wine?


Posts: 20000 - Show all posts

Offline

 

#4 2012-04-27 21:54:21

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: me.visible = true/false not working vb.net

veggieman001 wrote:

nathanprocks wrote:

I have never used Me.Visible before. I always use Me.Show and Me.Hide... I can't really debug your code because I am using Ubuntu and VB.NET doesn't work on Windows DP for some reason.

Have you tried it on Wine?

2010 does not work in WINE.


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#5 2012-04-28 03:50:22

DigiTechs
Scratcher
Registered: 2011-04-30
Posts: 500+

Re: me.visible = true/false not working vb.net

Try removing the apostrophies before the me.visible - I made that error once, and when I removed them, what I was making seemed to work fine.


I'm back.
Maybe.

Offline

 

#6 2012-04-28 06:02:48

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: me.visible = true/false not working vb.net

@DigiTechs: the apostrophe means it's been commented out. I think that's been done purposefully  wink

@Thread:
One very big mistake (and possibly the only one) you made is to use two separate IF clauses. Here's what the program does with you're code:
- visible is false
- goes through first if, value is 3, shows form (visible = true)
- goes through second if, and since visible = true, hides it again!

Therefore try using an IF-ELSE instead:
If Visible Then
   'do hiding
Else
   'do showing
End If

Offline

 

#7 2012-04-28 15:04:05

GameHutSoftware
Scratcher
Registered: 2010-04-24
Posts: 1000+

Re: me.visible = true/false not working vb.net

veggieman001 wrote:

nathanprocks wrote:

I have never used Me.Visible before. I always use Me.Show and Me.Hide... I can't really debug your code because I am using Ubuntu and VB.NET doesn't work on Windows DP for some reason.

Have you tried it on Wine?

my diseased mind read that weird
i read "have you tried it under the influence of wine?"

@DigiTechs
i just commented out that code because i wasnt using it

@LS97
THANK YOU SO MUCH IT WORKS

Last edited by GameHutSoftware (2012-04-28 15:07:01)


Lurking more than posting, but still here.

Offline

 

#8 2012-04-28 16:28:04

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: me.visible = true/false not working vb.net

You're welcome  smile
These are easy mistakes to make that we all eventually get over.

Offline

 

Board footer