Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How do I update a Form from a function?

How do I update a Form from a function?

Scheduled Pinned Locked Moved C / C++ / MFC
questioncsharpc++visual-studioannouncement
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Freddie Code
    wrote on last edited by
    #1

    I'm using Visual Studio 2005 C++. I want to update the controls on a form from within a function. The function is in a seperate file from the main form so the function can not "see" the memebers of the form. Do I have to pass the form to the function? The form controls seem to be "private" to the main form so I dont know if it will allow them to be changed from another function. Can someone give me some guidance on this, or a sample function call would be great. Thanks.

    F 1 Reply Last reply
    0
    • F Freddie Code

      I'm using Visual Studio 2005 C++. I want to update the controls on a form from within a function. The function is in a seperate file from the main form so the function can not "see" the memebers of the form. Do I have to pass the form to the function? The form controls seem to be "private" to the main form so I dont know if it will allow them to be changed from another function. Can someone give me some guidance on this, or a sample function call would be great. Thanks.

      F Offline
      F Offline
      Freddie Code
      wrote on last edited by
      #2

      Figured it out.... You need to go to the Class View, right click on your Form, Add New Function then choose the file that you want to add the function to. Make sure that the file you add the function to is #included into the project. Make sure the file you add the function to has #include "stdafx.h" as the first line of the file.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups