Kin Fat SZE
asked on
vb.net call sub with both parameters?
Hi
I can call this sub by
call ListCom_SelectedIndexChang ed(nothing ,nothing)
But would I able to call this sub with both of parameters?
ListCom_SelectedIndexChang ed(ListCom , "event.onclick")
I missunderstand how to call "onclick" event on second parameter?
Thank you!
Francis SZE
I can call this sub by
call ListCom_SelectedIndexChang
But would I able to call this sub with both of parameters?
ListCom_SelectedIndexChang
I missunderstand how to call "onclick" event on second parameter?
Thank you!
Francis SZE
Private Sub ListCom_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles ListCom.SelectedIndexChanged
rsCusObj.MoveFirst()
rsCusObj.Move((ListCom.SelectedIndex))
loadRecordSet()
End Sub
check this example:dim eargs as EventArgs = new EventArgs 'fill the EventArgs instanceListCom_SelectedIn dexChanged (ListCom, eargs )
ASKER
Hi,
I want to passing onclick into eargs ?
Could you please guide me?
if possible guide me how is onpress, onmouseover events into eargs?
Thank yoU!
Francis sZE
I want to passing onclick into eargs ?
Could you please guide me?
if possible guide me how is onpress, onmouseover events into eargs?
Thank yoU!
Francis sZE
why would u pass OnClick to ListCom_SelectedIndexChang ed?
why are you calling this sub explicitly anyway?
why are you calling this sub explicitly anyway?
you not using the eventArgs passed to ListCom_SelectedIndexChang ed anyway to better practive will to create another function which will have the current implementation of ListCom_SelectedIndexChang e.the you can call this function from anywhere in your code.
Private Sub ListCom_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles ListCom.SelectedIndexChanged
DoUpdate
End Sub
private sub DoUpdate()
rsCusObj.MoveFirst()
rsCusObj.Move((ListCom.SelectedIndex))
loadRecordSet()
end sub
ASKER
Hi,
I want to enable to passing second parameter System.EventArgs into sub ListCom_SelectedIndexChang ed
cause it may be useful in later on.
Also, that's what I want to learn....
Thank you!
Francis SZE
I want to enable to passing second parameter System.EventArgs into sub ListCom_SelectedIndexChang
cause it may be useful in later on.
Also, that's what I want to learn....
Thank you!
Francis SZE
Your sub:
Private Sub ListCom_SelectedIndexChang ed(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles ListCom.SelectedIndexChang ed
Doesn't use the variables eventSender and eventArgs that are sent into it, therefore the value of those vars is not important and you set their value to Nothing.
If the vars were read then the value of Nothing could cause an error.
In conclusion: You can call ListCom_SelectedIndexChang ed(nothing ,nothing) as long as the variables aren't in use.
Private Sub ListCom_SelectedIndexChang
Doesn't use the variables eventSender and eventArgs that are sent into it, therefore the value of those vars is not important and you set their value to Nothing.
If the vars were read then the value of Nothing could cause an error.
In conclusion: You can call ListCom_SelectedIndexChang
so what u can do is put a breakpoint in the ListCom_SelectedIndexChang ed and change index in the list to make it stop there (debug mode).
look how the EventArgs is essemble and use the same properties but crate them dynamically.
look how the EventArgs is essemble and use the same properties but crate them dynamically.
ASKER
the goal of this question is passing second parameter event.onclick to ListCom_SelectedIndexChang ed(ListCom , "event.onclick")
ListCom_SelectedIndexChang ed(nothing ,nothing) is works on this sub.
my goal is handling while second parameter eventargs would be needed.
sorry!
Thanks
Francis
ListCom_SelectedIndexChang
my goal is handling while second parameter eventargs would be needed.
sorry!
Thanks
Francis
Can you please try to explain what you want again?
ASKER
passing second parameter onclick event to sub ListCom_SelectedIndexChang ed(ListCom ,"onclick_ event")
dim myEvent as new System.EventArgs()
ListCom_SelectedIndexChang ed(ListCom , myEvent )
ListCom_SelectedIndexChang
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.