calling a control's event procedure

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I try to call an event procedure in any control from another control, I get the following error

frmDateType_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loa

ByVal is underlined and says 'expected expression'

Can anybody help me

polynomial5d
 
* =?Utf-8?B?cG9seW5vbWlhbDVk?= said:
When I try to call an event procedure in any control from another control, I get the following error.

frmDateType_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

ByVal is underlined and says 'expected expression'.

You will have to pass values to the procedure:

\\\
frmDateType_Load(Me, EventArgs.Empty)
///

Notice that this doesn't make much sense. Instead, move the code from
the event handler to a separate procedure and call this procedure from
the event handler and the other places in the code.
 
Thank you Mr. Wagner but it didn't work

Here's what I did.First I tried to refresh the data by refilling it in btnSubmitChanges. All the messges were correct.(Before I tried try catch but no errors were caught.
then I called the procedure you suggested


MsgBox(sCheck
Tr
MsgBox("in try"
If Check = 1 Then daDT.Fill(DsDT1, "DateType"
MsgBox("past if"
CheckAction(Check
Catch ex As Exceptio
MsgBox(ex.Message & s & ex.HelpLink & s & ex.StackTrace & s & ex.Source & s & "The form will be closed") '& s & ex.TargetSite
End Tr
If Check = 1 Then daDT.Fill(DsDT1, "DateType"
CheckAction(Check

Here's the procedure

Private Sub CheckAction(ByVal Check As Integer
If Check = 1 The
MsgBox(Check.ToString
daDT.Fill(DsDT1.DateType
MsgBox("After fill"
End I
btnLoad_Click(Me, EventArgs.Empty
End Su

Again the messageboxes made the right noises, but the dataset wasn't filled

So we went to a new button I put on the form(not visible

Same story. Can't understand why I can't reload the dataset in all three cases

So I made btnLoad visible. After all the preceding, I clicked it. That too didn't work

Seems strange to me.

polynomial5d
 
Well, what do you know? Nothing substitutes for a little work

If the dataset is already filled, to refresh it you first have to clear it

Private Sub CheckAction(ByVal Check As Integer
If Check = 1 The
MsgBox(Check.ToString
dsdt1.clea
daDT.Fill(DsDT1.DateType
MsgBox("After fill"
End I
btnLoad_Click(Me, EventArgs.Empty
End Su

And everything cleared up

Thank you for the information, however. I'm sure I'll have use for it

polynomial5d
 
Back
Top