Calling a Function from a Submit Button Click Event

LadyGail

Newcomer
Joined
May 5, 2003
Messages
13
I am learning ASP.NET, so please bear with me.
Using Visual Studio.NET I have three pages, an .aspx, .vb, and .aspx.vb. My .aspx page has text boxes, check boxes and a drop down list. The .vb has the class in which I wrote a function to insert records into the database. The .vb is located in another folder from the .aspx and .aspx.vb folder.

Using the click event of the submit button on the .aspx page I would like to call the insert function I created.

On the .aspx.vb page I am getting an error on the last line of this sub which reads [Argument not specified for parameter 'e' of 'Public Function insertNewDataPerformanceMeasures(sender As Object, e As System.EventArgs) As TestGale411.clPerfGroupMeasures'.]

Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim newPerformanceMeasure As New clPerfGroupMeasures()

newPerformanceMeasure.insertNewDataPerformanceMeasures()
End Sub

What does this error message mean and how do I fix the problem?

TY
LadyGail
 
This the insertNewDataPerformanceMeasures function.

Public Function insertNewDataPerformanceMeasures(ByVal sender As System.Object, ByVal e As System.EventArgs) As clPerfGroupMeasures
Dim newPerformanceMeasure As New clPerfGroupMeasures()
Dim sqlInsert As New SqlCommand()
Dim conn As SqlConnection = setConnection()
sqlInsert.CommandText = "Insert Into PerformanceMeasures " _
& " (PerfNum, TrackingDivision, PerformanceMeasures, TypeCode1, TypeCode2 " _
& " SuggestedPerformance, Qtr_OneResults, Qtr_TwoResults, Qtr_ThreeResults, Qtr_FourResults " _
& " Comments, GroupCode, Total, DivisionCode, AuthorizedUser1, AuthorizedUser2) values (" _
& " (10, ddlGroup.SelectedItem.Value, txtTrackingDivision.Text, txtPerformanceMeasures.Text, " _
& " chkCS.SelectedValue, chkED.SelectedValue, chkFIN.SelectedValue, chkQLTY.SelectedValue, txtPerformanceTarget.Text, " _
& " txtPerformanceTarget.Text, txtQtr1.Text, txtQtr2.Text, txtQtr3.Text, txtQtr4.Text, " _
& " txtComments.Text, txtGroup.Text, txtTotal.Text, 16, txtAuthorizedUser1.Text, txtAuthorizedUser1.Text) "

sqlInsert.Connection = conn
sqlInsert.Connection.Open()
sqlInsert.ExecuteNonQuery()
closeDatabase(conn)

End Function
 
Visual Basic:
 Public Function insertNewDataPerformanceMeasures(ByVal sender As System.Object, ByVal e As System.EventArgs) As clPerfGroupMeasures
Is there a reason for thee sender and parameters? they are normally associated with an event handler rather than a functioin / sub.

If you delete them from the definition things should work okay...
 
Thank you, that error has been erased and replace with something else, an unhandled exception error I am trying to track down.
 
Back
Top