943,965 Members | Top Members by Rank

Ad:
Nov 7th, 2009
0

calling event form module

Expand Post »
Hey, one simple question: how to call Image1_click event form module?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
deftones is offline Offline
27 posts
since Jul 2008
Nov 7th, 2009
0
Re: calling event form module
not like that. what will happen in click event that write in module. plz check it.
Attached Files
File Type: zip module.zip (1.7 KB, 62 views)
Reputation Points: 14
Solved Threads: 78
Practically a Posting Shark
abu taher is offline Offline
835 posts
since Jul 2008
Nov 8th, 2009
0

Click Event Image

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Command1_Click()
  2. Call sohel(Image1)
  3. End Sub

Module 1
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Public Function sohel(a As Image)
  2. a.Visible = False
  3. End Function
What do you actually want to happen when you click the command button? Will the image "load" from somewhere? Or change?

You cannot use a function to change yje visible factor of an image.

If you want to click the button then
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Command1_Click()
  2. if image1.visible=false then
  3. image1.visible=true
  4. elseif image1.visible=true then
  5. image1.visible=false
  6. end if
  7. end sub
Last edited by Jupiter 2; Nov 8th, 2009 at 10:37 am. Reason: if end if tags
Reputation Points: 33
Solved Threads: 27
Posting Whiz
Jupiter 2 is offline Offline
372 posts
since May 2009
Nov 8th, 2009
0
Re: calling event form module
Jupiter2,

Here is a way to shorten you comman1_click code...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Image1.Visible = Not Image1.Visible


Just a piece of knowledge I thought I would pass along.

As for the OP, deftones, Jupiter2 has most of what you need to accomplish what you want but allow me to clarify more...

As of right now I cannot see a way to directly call an images click event but you can create a public sub proceedure in your form and call it...

in module...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Call Form1.MySub

In Form...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Public Sub MySub()
  2. Call Image1_Click
  3. End Sub

However, if you were to call a command button then you could call it directly by...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Form1.Command1.Value = True



Good Luck
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
Nov 8th, 2009
0
Re: calling event form module
Oh, now it's clear what I did wrong - I forgot to declare "public", therefore wasn't able to call that sub from module. Thanks guys.
Reputation Points: 10
Solved Threads: 0
Light Poster
deftones is offline Offline
27 posts
since Jul 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Error checking for an existing record
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: making objects invisible





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC