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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Button Creation at Runtime....

Button Creation at Runtime....

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasedebugginghelpquestion
4 Posts 3 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.
  • B Offline
    B Offline
    blinkered
    wrote on last edited by
    #1

    Bit of a Newbie to this so bare with me... In my Visual C++ 6 Project, I have a Form View whereby I wish to create another button dependant on results from a Database. In the OnInitialUpdate() of the form I am trying to use the Create Function - but can only generate a debug assertion Failure. Is have used this line of code: m_Button.Create("My button", WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, CRect(10,10,100,30), this, 1); Am I doing anything obviously wrong? Any help would be appreciated...

    A T 2 Replies Last reply
    0
    • B blinkered

      Bit of a Newbie to this so bare with me... In my Visual C++ 6 Project, I have a Form View whereby I wish to create another button dependant on results from a Database. In the OnInitialUpdate() of the form I am trying to use the Create Function - but can only generate a debug assertion Failure. Is have used this line of code: m_Button.Create("My button", WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, CRect(10,10,100,30), this, 1); Am I doing anything obviously wrong? Any help would be appreciated...

      A Offline
      A Offline
      Alexander M
      wrote on last edited by
      #2

      Place code like that in OnInitDialog. Don't try it, just do it! ;-)

      B 1 Reply Last reply
      0
      • B blinkered

        Bit of a Newbie to this so bare with me... In my Visual C++ 6 Project, I have a Form View whereby I wish to create another button dependant on results from a Database. In the OnInitialUpdate() of the form I am trying to use the Create Function - but can only generate a debug assertion Failure. Is have used this line of code: m_Button.Create("My button", WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, CRect(10,10,100,30), this, 1); Am I doing anything obviously wrong? Any help would be appreciated...

        T Offline
        T Offline
        ThatsAlok
        wrote on last edited by
        #3

        blinkered wrote: m_Button.Create("My button", WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, CRect(10,10,100,30), this, 1); it working fine here in my test project,what ASSERTION notice are you getting.Second put a valid ID of button instead of Putting ID=1


        [Vote One Here, Complete my Survey....] Alok Gupta
        visit me at http://www.thisisalok.tk          "I Think Believe this Will Help"

        1 Reply Last reply
        0
        • A Alexander M

          Place code like that in OnInitDialog. Don't try it, just do it! ;-)

          B Offline
          B Offline
          blinkered
          wrote on last edited by
          #4

          Thanks - that works a treat. Next question though, how can I create an OnClick Event Handler for this button that will distinguish between the different Buttons I have created from the original Button object?

          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