[RESOLVED] Help with events
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: [RESOLVED] Help with events

  1. #1
    Join Date
    Jun 2010
    Posts
    3

    [RESOLVED] Help with events

    I have trapped the KeyDown event for my program. It detects the keypress properly. What I'd like to do after that is go and refresh the screen, a function called drawGame. The problem is that the keypress function is in frmgame.vb and the drawGame funciton is in clsGameEngine.vb, and the one can't see the other.

    Once I've clicked on the screen, the updates I've set in motion work; what I'd like to have is a function similar to the mouseclick, but one which triggers off the pc clock, i.e., refreshing every two seconds or so.

    However it does it, it MUST call back to the drawGame function; what I'm unsure of is how to get there from here. Can anyone help?

  2. #2
    Join Date
    Jun 2010
    Posts
    3

    Re: Help with events

    Actually, (chagrined smile) I answered my own question.

    the gameEngine . (dot operator) accessed a few functions already. One of those functions was the one that initialized the game. All I had to do was to make my drawGame function public, and voila! It was available under the dot operator, as follows:

    gameEngine.drawGame()

    It's important for newbies to understand the mechanics of how one section can call functions in another. Perhaps someone will write a tutorial on this. Thanks!

  3. #3
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,830

    Re: [RESOLVED] Help with events

    Also should note that this is apparently referring to dot net rather than VB6
    Always use [code][/code] tags when posting code.

  4. #4
    Join Date
    Dec 2008
    Location
    Step Into(F11)
    Posts
    465

    Smile Re: [RESOLVED] Help with events

    Please reread forum rules and then correct your post using correct code Tags BTW

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center