0

試しましたが、次のエラーが発生します。

Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30201: Expression expected.

Source Error:

Line 26:            password.Text = parseQuery("pass")
Line 27:        End If
Line 28:        If password.Text <> "" And username.Text <> "" Then btnLogin_Click(Dim sender as Object, Dim e as System.EventArgs)
Line 29:    End If
Line 30:    


Source File: C:\Inetpub\wwwroot\devv\login.aspx.vb    Line: 28
4

2 に答える 2

3

ステートメントを変更して、

If password.Text <> "" And username.Text <> "" Then 
   btnLogin_Click(Nothing, Nothing)
End If

現在のコードは、ボタンクリックイベントを作成しているかのように署名を使用しています。記述されている場合は、ダミー引数をメソッドに渡すだけです。

ただし、さまざまなメソッドを使用してログインをトリガーする場合は、ProcessLoginなどと呼ばれる2番目のメソッドを作成し、ボタンクリックイベントをそこにリダイレクトすることをお勧めします。これにより、ログイン処理に複数の「エントリベクトル」を設定しやすくなります。

于 2009-08-14T23:01:30.580 に答える
0

28行目をから変更する必要があります

If password.Text <> "" And username.Text <> "" Then btnLogin_Click(Dim sender as Object, Dim e as System.EventArgs)

If password.Text <> "" And username.Text <> "" Then btnLogin_Click(Nothing, EventArgs.Empty)
于 2009-08-14T23:04:32.913 に答える