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. How to connect variable to generated control ?

How to connect variable to generated control ?

Scheduled Pinned Locked Moved C#
tutorialquestion
5 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.
  • V Offline
    V Offline
    vgrigor
    wrote on last edited by
    #1

    I visually generated control, variable in code appears. But I have class derived from that type, (extend functionality to reuse), by which I want to handle visual part, I change type to derived, ... but editor not see precise type and removes control from the form. So, How to connect variable to control in such case ? Thanks

    H D 2 Replies Last reply
    0
    • V vgrigor

      I visually generated control, variable in code appears. But I have class derived from that type, (extend functionality to reuse), by which I want to handle visual part, I change type to derived, ... but editor not see precise type and removes control from the form. So, How to connect variable to control in such case ? Thanks

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

      I'm not sure I understand you (your question is very difficult to read, you might try elaborating a bit), but if you want to change the Type in your container (Form, UserControl, whatever), then make sure both the variable type declaration and the instantiated Type (in the InitializeComponent method) are the same, derived Type. Also make sure that that Type has been compiled and is either in the same project or a dependency project that has been referenced by your current project (when you right-click on the project and select Add Reference, select the project tab and add the project to make sure that a build dependency is established and that the build configuration (i.e., release, debug, whatever)is always in sync).

      Microsoft MVP, Visual C# My Articles

      1 Reply Last reply
      0
      • V vgrigor

        I visually generated control, variable in code appears. But I have class derived from that type, (extend functionality to reuse), by which I want to handle visual part, I change type to derived, ... but editor not see precise type and removes control from the form. So, How to connect variable to control in such case ? Thanks

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        ??????????????????????????????????????????? This doesn't make any sense what-so-ever... Are you saying that you created your own UserControl class, inheriting from an existing control? Did you drop YOUR control on the form, or drop the base control that you inherited from? If you want to use YOUR version of the control, you'll have to add it to the Toolbox, then drag that onto your form, not the control you inherited from. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        V 1 Reply Last reply
        0
        • D Dave Kreskowiak

          ??????????????????????????????????????????? This doesn't make any sense what-so-ever... Are you saying that you created your own UserControl class, inheriting from an existing control? Did you drop YOUR control on the form, or drop the base control that you inherited from? If you want to use YOUR version of the control, you'll have to add it to the Toolbox, then drag that onto your form, not the control you inherited from. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          V Offline
          V Offline
          vgrigor
          wrote on last edited by
          #4

          Witout new control creation - in a visual way, I can not do it programmatically - to just add some small functions, in inherited class? but continue to edit all other properties - visually. (control disappear from editor) As extending Buttton in other languages, pure programmatically ?

          D 1 Reply Last reply
          0
          • V vgrigor

            Witout new control creation - in a visual way, I can not do it programmatically - to just add some small functions, in inherited class? but continue to edit all other properties - visually. (control disappear from editor) As extending Buttton in other languages, pure programmatically ?

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            What your saying is VERY difficult to understand. Are you saying that you want to set the properties of a control in a Properties Page like Visual Studio has in the bottom right corner of the screen? Is this control one that you wrote? Are you trying to write your own extended Button class and have your extended properties show up in the Property Page? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

            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