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#
  4. form_load is not suitable

form_load is not suitable

Scheduled Pinned Locked Moved C#
comhtmltutorialquestion
2 Posts 2 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.
  • H Offline
    H Offline
    hazzem elrefai
    wrote on last edited by
    #1

    I have windowsform that display Word document using DSOFramer activex from microsoft support website and i put the code that load this doc at load event of the form, but it doesn't work and when i added button to the form and made this button_click loads the word file it works so i think that the form.load event is not suitable and i do not know how to make this file opens auomaticly without using the form load event thnx in advance

    H 1 Reply Last reply
    0
    • H hazzem elrefai

      I have windowsform that display Word document using DSOFramer activex from microsoft support website and i put the code that load this doc at load event of the form, but it doesn't work and when i added button to the form and made this button_click loads the word file it works so i think that the form.load event is not suitable and i do not know how to make this file opens auomaticly without using the form load event thnx in advance

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      It's worked for me in the past to simply override the Form.OnHandleCreated method (it's better to override in derived classes than handle events) for ActiveX controls using something like:

      public class MyForm : Form
      {
      // ...
      protected override void OnHandleCreated(EventArgs e)
      {
      base.OnHandleCreated(e); //
      // Put your initialization code here and add it to the Controls property
      }
      }

      The ActiveX control will most likely require a window handle (HWND) in which to be sited (parented). Calling base.OnHandleCreate first makes sure that everything is set up correctly. This handler is called by CreateHandle after creating the handle. It's possible that the DSOFramer requires something different, though. You should check the Microsoft KB[^] or any existing product site for that control for specifics.

      Microsoft MVP, Visual C# My Articles

      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