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. Creating Control at Design time

Creating Control at Design time

Scheduled Pinned Locked Moved C#
csharpdesigntutorialquestion
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.
  • S Offline
    S Offline
    Said Ali Jalali
    wrote on last edited by
    #1

    :rose::rose::rose: Hi. Can you tell me how can i create a control at Design time but with my own c# code. For example:

    TextBox textBox=new TextBox();
    textBox.Name="My textBox";
    myForm.Controls.Add(textBox);
    myForm.Refresh;

    I want to run this Code as Design Time.It works at run time but i don't want that. I want to do some thing like DataGridView that add columns at Design Time. Thank you all. :rose::rose::rose:

    CanI

    D 1 Reply Last reply
    0
    • S Said Ali Jalali

      :rose::rose::rose: Hi. Can you tell me how can i create a control at Design time but with my own c# code. For example:

      TextBox textBox=new TextBox();
      textBox.Name="My textBox";
      myForm.Controls.Add(textBox);
      myForm.Refresh;

      I want to run this Code as Design Time.It works at run time but i don't want that. I want to do some thing like DataGridView that add columns at Design Time. Thank you all. :rose::rose::rose:

      CanI

      D Offline
      D Offline
      DaveyM69
      wrote on last edited by
      #2

      All controls are created and added in the designer.cs file for your form by default. You can look there and see where to write the code for the various aspects but be careful - you shouldn't really edit that file by hand. You should use this where you have written myForm above. Using the designer's drag and drop facilities is a lot quicker and easier IMO.

      Dave

      If this helped, please vote & accept answer!

      Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
      BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

      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