[Help]Button1 not declared[Solved]

Posts 1–15 of 32 · Page 1 of 3
[Help]Button1 not declared[Solved]


Anyone know a way to fix this?

Code:
Module Module1
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
    Public Sub HotKey(ByVal hotkey As Boolean)
        HotKey = GetAsyncKeyState(Keys.Insert) 'Change to any hotkey
        If hotkey = True Then
            Button1.Click()
            'Do something
            'add your code here when the hotkey is pressed
        End If
    End Sub
End Module
From this guide:http://www.mpgh.net/forum/33-visual-...odule-new.html
Add A button to your form....

That's the problem with C&P and lacking the basic concept and understanding of the language you are attempting to work with.

When you add a button to the form it will assign it a name.

The first button you add will be called (by default) button1.

Now considering you are working with modules, you may need to add the form name first.

IE : Button1 won't be called button1 if it is on form1 it will be called

Form1.Button1

If it is on form2 it is

Form2.Button1

get it?..

Quote Originally Posted by NextGen1 View Post
Add A button to your form....

That's the problem with C&P and lacking the basic concept and understanding of the language you are attempting to work with.

When you add a button to the form it will assign it a name.

The first button you add will be called (by default) button1.

Now considering you are working with modules, you may need to add the form name first.

IE : Button1 won't be called button1 if it is on form1 it will be called

Form1.Button1

If it is on form2 it is

Form2.Button1

get it?

Quote Originally Posted by Lolland View Post
Flamerage more guys...

I had a fuckin' button added - -'

I even tried a few solutions that it suggested, but I got nothin'

Should have specified that in the first post.

I didn't know the Form1.Button1 though. Much appreciated, I'll try that in a few.
Don't flame next time - -'
Quote Originally Posted by Alroundeath View Post
Flamerage more guys...

I had a fuckin' button added - -'

I even tried a few solutions that it suggested, but I got nothin'

Should have specified that in the first post.

I didn't know the Form1.Button1 though. Much appreciated, I'll try that in a few.
Don't flame next time - -'
0.0 Sorry.

Is button1 named button1?
I wasn't FlameRaging, I was offering you a solution.

My Comment on C&P is the same thing I would tell anyone, C&P code will not work, You have to understand the language.

That goes for any language, and anyone.....

One of my biggest pet peeves is when someone C&P's Code and offers no credits, So I am assuming if you release anything at mpgh.net you will offer credit, that is all

The Hello World Application explains adding a button to a form. So, I assume this is really your first run in, and I offered help. Start basic, learn the language, that is what are tuts are for, learning , not just taking.
Marked Solved, Don't post unless under <=7Days and necessary
Quote Originally Posted by NextGen1 View Post
I wasn't FlameRaging, I was offering you a solution.

My Comment on C&P is the same thing I would tell anyone, C&P code will not work, You have to understand the language.

That goes for any language, and anyone.....

One of my biggest pet peeves is when someone C&P's Code and offers no credits, So I am assuming if you release anything at mpgh.net you will offer credit, that is all

The Hello World Application explains adding a button to a form. So, I assume this is really your first run in, and I offered help. Start basic, learn the language, that is what are tuts are for, learning , not just taking.
Marked Solved, Don't post unless under <=7Days and necessary

Well.. I got THAT part solved... Here's another issue... xD

Code:
Module Module1
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
    Public Sub HotKey(ByVal hotkey As Boolean)
        hotkey = GetAsyncKeyState(Keys.F7) 'Change to any hotkey
        If hotkey = True Then
            Form1.Timer1.Enabled = True
            'Do something
            'add your code here when the hotkey is pressed
        End If
    End Sub
End Module
And
Code:
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        SendKeys.Send(TextBox1.Text)
        SendKeys.Send("{Enter}")
        HotKey(True)
    End Sub
This is following Pixie's guide to global HotKeys.

It also tells me to enable to timer, when I do that, I get this error:



If this is another noob fuck up, then Imma go back to basics xD
Quote Originally Posted by Alroundeath View Post
Well.. I got THAT part solved... Here's another issue... xD

Code:
Module Module1
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
    Public Sub HotKey(ByVal hotkey As Boolean)
        hotkey = GetAsyncKeyState(Keys.F7) 'Change to any hotkey
        If hotkey = True Then
            Form1.Timer1.Enabled = True
            'Do something
            'add your code here when the hotkey is pressed
        End If
    End Sub
End Module
And
Code:
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        SendKeys.Send(TextBox1.Text)
        SendKeys.Send("{Enter}")
        HotKey(True)
    End Sub
This is following Pixie's guide to global HotKeys.

It also tells me to enable to timer, when I do that, I get this error:



If this is another noob fuck up, then Imma go back to basics xD

Try this:

Code:
Public Sub hotkey()
        If GetAsyncKeyState(Keys.F7) Then
            MsgBox("F7 key pressed ")
        End If
    End Sub
Image code was not working for me either. This works fine for me. Lemme know if it works for you !!!
What OS are you using and cpu x86 or x64
.. You should blur some stuff on pictures..
I already can tell you have a friend called Jared [jaredt74@gmail.com] and you use TuneUpUtilities 2010.
I'm Just saying.
/Nuffsaid
Quote Originally Posted by Invidus View Post
.. You should blur some stuff on pictures..
I already can tell you have a friend called Jared [jaredt74@gmail.com] and you use TuneUpUtilities 2010.
I'm Just saying.
/Nuffsaid
No worries =p
Can't do shit with that info anyways.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
Quote Originally Posted by MJLover View Post
Try this:

Code:
Public Sub hotkey()
        If GetAsyncKeyState(Keys.F7) Then
            MsgBox("F7 key pressed ")
        End If
    End Sub
Image code was not working for me either. This works fine for me. Lemme know if it works for you !!!
Tried that, didn't work... Same exact error.
try reinstalling vb.
Quote Originally Posted by Blubb1337 View Post
try reinstalling vb.
I just recently installed it xD It's something that I'm not doing right...

Gotta be something simple that I'm probably over-looking.
Long becomes Integer, Integer becomes Short

Cryptic enough for you?

Posts 1–15 of 32 · Page 1 of 3
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us