By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,905 Members | 1,654 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,905 IT Pros & Developers. It's quick & easy.

fire a click event from another form

P: n/a
Hello

I have two forms - a start form running in the background and a content form in the foreground. When a timer fires on the start form, I need to fire the click event for a button on the other form. I have delcalered the 2nd form as a friend, but still cannot get to the button's click event

Any help would be very appreciated

thnx
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi

If you are using the Mdiform use the following statements. and note that you need to declare the procedure which is handling the event Click of the button as public

Dim f2 As Form2 = CType(Me.MdiParent.MdiChildren(1), Form2
f2.Button1_Click(f2.Button1, New System.EventArgs()

where button1 is the button placed in the form2

Actually here you are not raising the event, we are indirectly tiggering the event by calling a procedure

If you don't have a MDI form. Have some public module and keep the instance of form2 there and access it in form2 or keep the instance in the form1 itself and access it

I hope this may help you

Sadha Sivam
Malleable Minds Software Pvt Ltd.
India
Nov 20 '05 #2

P: n/a
Hi
try this
------------------------------
Dim foo As New Form2
Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
foo.Show()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
'call the button on form 2
foo.ButtonOnForm2.PerformClick()

'call a sub on from2
foo.subOnForm2()
End Sub
-----------------------------------
/jens
"eveready" <an*******@discussions.microsoft.com> wrote in message
news:7E**********************************@microsof t.com...
Hello,

I have two forms - a start form running in the background and a content form in the foreground. When a timer fires on the start form, I need to
fire the click event for a button on the other form. I have delcalered the
2nd form as a friend, but still cannot get to the button's click event.
Any help would be very appreciated -

thnx

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.