tags:

views:

16

answers:

2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    CheckBox1.Checked = True
    While CheckBox1.Checked = True
        SendKeys("{END}")
    End While
End Sub

That is the code, the error is "SendKeys is a type and cannot be used as an expression." How could I fix this? Thanks!

A: 

remove the parentheses - in VB6 parentheses are used only in functions not procedures.

SendKeys "{END}"

alternatively

Call SendKeys("{END}")
renick
This did not work. When I try your first option, it automatically adds the brackets, when I try the second option, it says the same error as posted in the question.
Anonymous the Great
That's not VB6...
Richard Hein
+2  A: 

use

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    CheckBox1.Checked = True
    While CheckBox1.Checked = True
        SendKeys.Send("{END}")
    End While
End Sub

You need to refer SendKeys.Send();

VOX
Thank you very much!
Anonymous the Great