INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

BC30269: 'Protected Sub btnLogin_Click error

BC30269: 'Protected Sub btnLogin_Click error

(OP)
Hello

I am getting the following error:

BC30269: 'Protected Sub btnLogin_Click(sender As Object, e As EventArgs) 'has multiple definitions with identical signatures'.

I take it that the error refers to the fact that I use Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) again in the same aspx file?

Is it possible to remove one Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'header' and combine the code under a single 'header' or how else to deal with the error?

Many thanks

RE: BC30269: 'Protected Sub btnLogin_Click error

Simple answer: you are correct, but only you can determine if you can "combine" them.

More complicated: Basically what you've ended up with is two methods with the same name in the same class. Remember classes can be split between files (partial classes), or even inherited. Whenever you have two methods with the same name and the same parameters in the same class you will get this error.

You haven't really given us the code for the headers methods, so we can't really tell you if you can combine them. You'll have to work out the logic of each method, and the order of operations that need to happen to be able to determine if/how you can combine them. ONE of them has to go in order to get rid of the error and put your application into a working state.

Based on the name of your methods "btnLogin_Click" it looks like it is supposed to be an event handler for a button. While you CAN have multiple handlers for an event (with different method names: "btnLogin_Click" and "btnLogin_Click_1"), it is not advisable to split up your code that way - it is more confusing for the program flow.

RE: BC30269: 'Protected Sub btnLogin_Click error

(OP)
Thanks for getting back to me, Borvik.

One sub relates to a user logging on via a login form so the code will scrutinise the database to check that he exists as a registrant. This code (I am sure there are errors with it as I have not done a login form before) is:

CODE --> VB

Protected Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click

        Dim strEmail As Boolean

        Dim result As String = VerifyAccount(strEmail, password.Text)

        If result = True Then

            Session("ValidUser") = True

            Session("strEmail") = GetUser(strEmail)

            Response.Redirect("userpage.aspx")

        Else

            Session("ValidUser") = False


        End If

    End Sub 

while the second btnLogin_Click , sets up cookies if that user has checked/ticked the 'Remember Me' checkbox.

To me, there is a logic in that order of things but, as I say, it's the first time I have done this.

Thanks again.

RE: BC30269: 'Protected Sub btnLogin_Click error

Your code does not look like VB.NET (to me)
Are you sure you are in the right Forum here at TT...?
Shouldn't you be in ASP.NET, maybe...?

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.

RE: BC30269: 'Protected Sub btnLogin_Click error

I can see the confusion - ASP.NET can be either VB or C#, and Everton1Blue is using VB codebehind for it.

However, Andrzejek is also correct - as ASP.NET has its own forum: forum855: Microsoft: ASP.NET. Please direct further ASP.NET inquiries there.

Regarding the logic - the "Remember Me" part of the login procedure should only be run if the login was successful. With two separate button handlers, it would get run regardless. The remember me code should go in the block that successfully logs in the user - just before the Response.Redirect call.

RE: BC30269: 'Protected Sub btnLogin_Click error

(OP)
Andrzejek

Visual Studio (ASP.NET) uses both C# and VB.NET.

RE: BC30269: 'Protected Sub btnLogin_Click error

(OP)
'The remember me code should go in the block that successfully logs in the user - just before the Response.Redirect call'.

That sounds logical now that you point it out. I will do that, and get rid of the second button.

OK, I will subscribe to the ASP.NET room here.

Thanks again

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close