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
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