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. Mobile Development
  3. Mobile
  4. Turn off graphical inheritance

Turn off graphical inheritance

Scheduled Pinned Locked Moved Mobile
csharpooptutorialquestion
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.
  • D Offline
    D Offline
    donkaiser
    wrote on last edited by
    #1

    I have to have form2 inheriting all the methods and variable in form1. but I don't want to have the graphical stuff from form1. how to by pass that? because when i specify form2 inherit from form1 and run the program, it shows on the graphical components of form1 on form2. Im using C# with VS2005 Donkaiser

    M 1 Reply Last reply
    0
    • D donkaiser

      I have to have form2 inheriting all the methods and variable in form1. but I don't want to have the graphical stuff from form1. how to by pass that? because when i specify form2 inherit from form1 and run the program, it shows on the graphical components of form1 on form2. Im using C# with VS2005 Donkaiser

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      All controls are created in code in C#. The forms designer places the control declarations in the FormName.Designer.cs file, which you can see when you click the [+] next to your class in the Solution Explorer. This file contains the InitializeComponent method, which is called by the class constructor. Form2's constructor calls Form1's constructor, which calls Form1.InitializeComponent; then Form2's constructor calls Form2.InitializeComponent. You'll have to come up with a way of stopping Form1's InitializeComponent being called. I would recommend moving the data manipulation methods and variables out of the Form1 class into a different class, making Form1 and Form2 use that new class, and removing the inheritence link between Form1 and Form2. Stability. What an interesting concept. -- Chris Maunder

      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