this is my 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 Classfor 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?
Offline
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.
Offline
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?
Offline
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.
Offline
@DigiTechs: the apostrophe means it's been commented out. I think that's been done purposefully
@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
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)
Offline
You're welcome
These are easy mistakes to make that we all eventually get over.
Offline