Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Button1.PerformClick() problem

Reply
Thread Tools

Button1.PerformClick() problem

 
 
Marcin Zmyslowski
Guest
Posts: n/a
 
      09-02-2005
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

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
Pauly T
Guest
Posts: n/a
 
      09-02-2005
You can't have html tags in your code-behind or other class files. If you
remove all the code before your "Imports" calls, your class should be fine.

Pauly T
www.eMembersOnline.com

"Marcin Zmyslowski" <(E-Mail Removed)> wrote in message
news:OyCZ0$(E-Mail Removed)...
> 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
>
> *** Sent via Developersdex http://www.developersdex.com ***



 
Reply With Quote
 
 
 
 
Marcin Zmyslowski
Guest
Posts: n/a
 
      09-05-2005


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

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM



Advertisments