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. User control Name

User control Name

Scheduled Pinned Locked Moved C#
winforms
10 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.
  • C Offline
    C Offline
    chrisclarke11
    wrote on last edited by
    #1

    Hi I have a libary with some user controls which are used on different projects. What i want to do is when one of these controls are place on a form, you have to set the controls name before its added to the project. Is this possible at all. Thanks Chris

    Chris

    F OriginalGriffO 3 Replies Last reply
    0
    • C chrisclarke11

      Hi I have a libary with some user controls which are used on different projects. What i want to do is when one of these controls are place on a form, you have to set the controls name before its added to the project. Is this possible at all. Thanks Chris

      Chris

      F Offline
      F Offline
      freakyit
      wrote on last edited by
      #2

      hiiiii, for me it sounds you developed your own Designer ?!?? in that case you need to implemented the INameCreationService. :)

      C 1 Reply Last reply
      0
      • F freakyit

        hiiiii, for me it sounds you developed your own Designer ?!?? in that case you need to implemented the INameCreationService. :)

        C Offline
        C Offline
        chrisclarke11
        wrote on last edited by
        #3

        hi No i havent developed my own designer. Just that i want to be promted to input the controls name

        Chris

        1 Reply Last reply
        0
        • C chrisclarke11

          Hi I have a libary with some user controls which are used on different projects. What i want to do is when one of these controls are place on a form, you have to set the controls name before its added to the project. Is this possible at all. Thanks Chris

          Chris

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          If what you are asking is "When a designer drags my UserControl from the ToolBox to his form, he should be prompted to set the controls Name property - how do I do it?" Then AFAIK you can't. And you probably shouldn't if you can. If you did, it would make your control very different from the normal VS controls, and would probably really annoy some developers. Most of us do not use the default name fro most controls, preferring "tbPrintStatement" to "button52", but even I do not rename labels and so forth! If VS started insisting I did, I would be a bit pissed off. Generally, I place my controls as a bunch, then change the name and text at the same time.

          Did you know: That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          C F 2 Replies Last reply
          0
          • OriginalGriffO OriginalGriff

            If what you are asking is "When a designer drags my UserControl from the ToolBox to his form, he should be prompted to set the controls Name property - how do I do it?" Then AFAIK you can't. And you probably shouldn't if you can. If you did, it would make your control very different from the normal VS controls, and would probably really annoy some developers. Most of us do not use the default name fro most controls, preferring "tbPrintStatement" to "button52", but even I do not rename labels and so forth! If VS started insisting I did, I would be a bit pissed off. Generally, I place my controls as a bunch, then change the name and text at the same time.

            Did you know: That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.

            C Offline
            C Offline
            chrisclarke11
            wrote on last edited by
            #5

            Yes thats what i'm trying to do. I have wrote a set of controls for an HMI. the idea is to remove as much of the need for code as possibel so that some of my fellow engineers can do simple changes to the screens. It would be really anoying if all controls did this but we just want the ones we have designed.

            Chris

            OriginalGriffO 1 Reply Last reply
            0
            • OriginalGriffO OriginalGriff

              If what you are asking is "When a designer drags my UserControl from the ToolBox to his form, he should be prompted to set the controls Name property - how do I do it?" Then AFAIK you can't. And you probably shouldn't if you can. If you did, it would make your control very different from the normal VS controls, and would probably really annoy some developers. Most of us do not use the default name fro most controls, preferring "tbPrintStatement" to "button52", but even I do not rename labels and so forth! If VS started insisting I did, I would be a bit pissed off. Generally, I place my controls as a bunch, then change the name and text at the same time.

              Did you know: That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.

              F Offline
              F Offline
              freakyit
              wrote on last edited by
              #6

              hmmm i have to agree with you every time a promting for the name would suck :) actually you need to write an addin for the IDE (VS oder #Develop). The addin should override the INameCreationService of the DesignerHost. then you can create a name the "normal" way or prompt for it :) sooo far ;)

              1 Reply Last reply
              0
              • C chrisclarke11

                Yes thats what i'm trying to do. I have wrote a set of controls for an HMI. the idea is to remove as much of the need for code as possibel so that some of my fellow engineers can do simple changes to the screens. It would be really anoying if all controls did this but we just want the ones we have designed.

                Chris

                OriginalGriffO Offline
                OriginalGriffO Offline
                OriginalGriff
                wrote on last edited by
                #7

                Nasty! If you are letting your engineers make "simple changes to the screens" you do realise they will need full VS to do it? Which means they could do anything to your screens. Including f@ck them up completely... If these guys are not bright enough to be trusted with default names and the ability to change them, then why are you going to trust them not to make a complete pigs-ear of the whole system?

                Did you know: That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.

                "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                1 Reply Last reply
                0
                • C chrisclarke11

                  Hi I have a libary with some user controls which are used on different projects. What i want to do is when one of these controls are place on a form, you have to set the controls name before its added to the project. Is this possible at all. Thanks Chris

                  Chris

                  F Offline
                  F Offline
                  freakyit
                  wrote on last edited by
                  #8

                  alright i have the solution worked out!! :) but you need to wait till i am at home ;) i will write an article about your problem because this is very interesing stuff :) so please be patient.. greetz all over the world

                  C 1 Reply Last reply
                  0
                  • F freakyit

                    alright i have the solution worked out!! :) but you need to wait till i am at home ;) i will write an article about your problem because this is very interesing stuff :) so please be patient.. greetz all over the world

                    C Offline
                    C Offline
                    chrisclarke11
                    wrote on last edited by
                    #9

                    ok Thanks in advance Chris

                    Chris

                    F 1 Reply Last reply
                    0
                    • C chrisclarke11

                      ok Thanks in advance Chris

                      Chris

                      F Offline
                      F Offline
                      freakyit
                      wrote on last edited by
                      #10

                      here i hope it works :) and will be published :) UserControl prompts for ControlName after drop in the Designer.[^] kind regards, freakyit

                      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