Good day,
In my application, I have Private Sub btnSendSMS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSendMessage.Click
in my program.
I would like to simulate a button click of the above within my other sub (an SMS receive detector) when an SMS is received.
How do I do this? I know this is not the best way of doing things but just for the sake of learning. Thanks.
To simulate the button click in code, you simply call the event handler: Button1_Click(object sender, EventArgs e). protected void Page_Load(object sender, EventArgs e) { //This simulates the button click from within your code. Button1_Click(Button1, EventArgs.
You can call the Button.PerformClick
method:
btnSendSMS.PerformClick()
You can call the function directly.
btnSendSMS_Click(Me, EventArgs.Empty)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With