dynamic user interface (win app)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roy Lawson

    #1

    dynamic user interface (win app)

    I want to enable the user to define parts of their user interface. I
    am developing an application that does some accounting functions
    (basicly the end user enters revenues for each account, and users will
    frequently enter data in several accounts that I want visible based
    upon the company).

    Anyways, not that the brief description I just gave you will help, but
    any ideas on how to dynamicly populate controls on a winform?? What
    would be the winform equivilent of the ASP.NET repeater control? Or
    am I on the wrong track?

    Thanks,

    -RL
  • Darin

    #2
    Re: dynamic user interface (win app)

    Roy,

    I use a dataset the retrieves data from a db to dynamically build controls
    on a winform. You could also use XML to do it. If you want to see an
    example just respond back and I will email it to you or post the code on
    here.

    Good Luck

    "Roy Lawson" <roy@xeon.tv> wrote in message
    news:c4e77fc0.0 312311435.fd914 09@posting.goog le.com...[color=blue]
    > I want to enable the user to define parts of their user interface. I
    > am developing an application that does some accounting functions
    > (basicly the end user enters revenues for each account, and users will
    > frequently enter data in several accounts that I want visible based
    > upon the company).
    >
    > Anyways, not that the brief description I just gave you will help, but
    > any ideas on how to dynamicly populate controls on a winform?? What
    > would be the winform equivilent of the ASP.NET repeater control? Or
    > am I on the wrong track?
    >
    > Thanks,
    >
    > -RL[/color]


    Comment

    • Simon

      #3
      Re: dynamic user interface (win app)

      Hi all,

      I am interested like to see the example. Could you post
      the code here.

      Thanks

      Simon
      [color=blue]
      >-----Original Message-----
      >Roy,
      >
      >I use a dataset the retrieves data from a db to[/color]
      dynamically build controls[color=blue]
      >on a winform. You could also use XML to do it. If you[/color]
      want to see an[color=blue]
      >example just respond back and I will email it to you or[/color]
      post the code on[color=blue]
      >here.
      >
      >Good Luck
      >
      >"Roy Lawson" <roy@xeon.tv> wrote in message
      >news:c4e77fc0. 0312311435.fd91 409@posting.goo gle.com...[color=green]
      >> I want to enable the user to define parts of their[/color][/color]
      user interface. I[color=blue][color=green]
      >> am developing an application that does some accounting[/color][/color]
      functions[color=blue][color=green]
      >> (basicly the end user enters revenues for each[/color][/color]
      account, and users will[color=blue][color=green]
      >> frequently enter data in several accounts that I want[/color][/color]
      visible based[color=blue][color=green]
      >> upon the company).
      >>
      >> Anyways, not that the brief description I just gave[/color][/color]
      you will help, but[color=blue][color=green]
      >> any ideas on how to dynamicly populate controls on a[/color][/color]
      winform?? What[color=blue][color=green]
      >> would be the winform equivilent of the ASP.NET[/color][/color]
      repeater control? Or[color=blue][color=green]
      >> am I on the wrong track?
      >>
      >> Thanks,
      >>
      >> -RL[/color]
      >
      >
      >.
      >[/color]

      Comment

      • Tian Min Huang

        #4
        RE: dynamic user interface (win app)

        Hello,

        Thanks for your post. As I understand, you want to dynamically add controls
        to WinForms. Please correct me if there is any misunderstandin g. The Form
        class in WinForm includes a control collection representing a collection
        of controls on the form. We just need to create a control (say, button,
        etc) and then add it to Form.ControlCol lection. I believe the following
        articles/samples are helpful:

        Form.ControlCol lection Class
        http://msdn.microsoft.com/library/de...us/cpref/html/
        frlrfsystemwind owsformsformcon trolcollectionc lasstopic.asp?f rame=true

        Adding a control to a form programmaticall y


        Please feel free to let me know if you have any problems or concerns.

        Regards,

        HuangTM
        Microsoft Online Partner Support
        MCSE/MCSD

        Get Secure! -- www.microsoft.com/security
        This posting is provided "as is" with no warranties and confers no rights.

        Comment

        • Darin

          #5
          Re: dynamic user interface (win app)

          Here is some code to create a dynamic control:
          string controlType = System.Windows. Forms.Label or
          System.Windows. Forms.TextBox.. .

          Assembly assem = Assembly.GetAss embly(typeof(Fo rm));
          Type t = assem.GetType(c ontrolType);
          object obj = Activator.Creat eInstance(t);
          Control tb = (Control)obj;
          this.Controls.A dd(tb);

          All of my data is stored in a db table and based on user input the app
          retrieves the data to create the controls. It just loops through each row
          retrieved. In a web app, I have used an XML file to create dynamic controls
          using the same approach except for writing some code to extract the data
          from the xml file.

          I also have seen another approachs where you create component class with a
          Factory Class, IControl interface, and Control Classes. I like the approach
          above better because it gives you better control over creating the control.
          Especially if you need to add event handlers and so on.

          Hope this helps out.

          "Roy Lawson" <roy@xeon.tv> wrote in message
          news:c4e77fc0.0 312311435.fd914 09@posting.goog le.com...[color=blue]
          > I want to enable the user to define parts of their user interface. I
          > am developing an application that does some accounting functions
          > (basicly the end user enters revenues for each account, and users will
          > frequently enter data in several accounts that I want visible based
          > upon the company).
          >
          > Anyways, not that the brief description I just gave you will help, but
          > any ideas on how to dynamicly populate controls on a winform?? What
          > would be the winform equivilent of the ASP.NET repeater control? Or
          > am I on the wrong track?
          >
          > Thanks,
          >
          > -RL[/color]


          Comment

          Working...