Button1.PerformClick() problem

  • Thread starter Marcin Zmyslowski
  • Start date
M

Marcin Zmyslowski

Hello everybody!

I have the problem with using Button1.PerformClick() method.

I don`t know how to call the button. I have been searching the
newsgroups but I didn`t find any exact description of it.

I have read that to do that I have to paste the code:

---------------------------------------------------

<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<%@ import Namespace="System.DBNull" %>
<%@ import Namespace="System.Web.UI.WebControls" %>
<script runat="server">





Imports System
Imports System.Windows.Forms
Imports System.Drawing


Public Class MyButton
Inherits ButtonBase
Implements IButtonControl
Private myDialogResult As DialogResult

Public Sub New()
' Make the button White and a Popup style
' so it can be distinguished on the form.
Me.FlatStyle = FlatStyle.Popup
Me.BackColor = Color.White
End Sub

' Add implementation to the IButtonControl.DialogResult property.
Public Property DialogResult() As DialogResult Implements
IButtonControl.DialogResult
Get
Return Me.myDialogResult
End Get

Set
If [Enum].IsDefined(GetType(DialogResult), value) Then
Me.myDialogResult = value
End If
End Set
End Property

' Add implementation to the IButtonControl.NotifyDefault method.
Public Sub NotifyDefault(value As Boolean) Implements
IButtonControl.NotifyDefault
If Me.IsDefault <> value Then
Me.IsDefault = value
End If
End Sub

' Add implementation to the IButtonControl.PerformClick method.
Public Sub PerformClick() Implements IButtonControl.PerformClick
If Me.CanSelect Then
Me.OnClick(EventArgs.Empty)
End If
End Sub

End Class

------------------------------------------------------

...and I did it. But I got the error:

'Imports' statements must precede any declarations.

I want to call the Button1_Click(sender As Object, e As EventArgs)
procedure. Previously I wanted to do that by writing Button1_Click() but
I got the error, so I tried to use Button1.PerformClick() method, but I
cannot use to completely to make it working.

Could you help me???

I would be very grateful

Thank you in advance
Marcin from Poland
 
M

Marcin Zmyslowski

OK I have checked and I have removed all the code before "Imports"
calling, but I have just got the following error:
--------------------------------------------------
BC30455: Argument not specified for parameter 'e' of 'Public Sub
Button1_Click(sender As Object, e As System.EventArgs)'.

Source Error:


Line 175:
Line 176:
Line 177: Button1_Click.PerformClick()
Line 178:
Line 179: End Sub
--------------------------------------------------

What argument should I write to call this method?

Thank you in advance
Marcin from Poland
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top