Is this Possible ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Newman

    #1

    Is this Possible ?

    I would like to attempt to create a dynamic form. The scenerio is when a user
    logs onto the system, it will get a list of 'Areas' in the application that
    the user has permission to enter. I want to dynamicly add buttons on the
    form ( in two coloums 8 to a coloum ) and have an 'click' event. Also i
    would like to be able to change the 'text' of the button.. can anybody show
    me the basics please or a good tutorial
  • Stuart Nathan

    #2
    Re: Is this Possible ?

    Something like this and from memory only

    Public Event Clicked( byval Value as String)
    Private Btn(6) as Windows.Forms.B utton (check this?)

    Private Sub HaveBeenClicked ( can't remember arguments, but must be the same
    as click event)

    code here..
    RaiseEvent Clicked( text)

    End Sub

    Public Sub Form_Load()
    For i as integer=0 to 6
    Btn(i)=New Button
    AddHandler Btn(i).Click, Addressof HaveBeenClicked
    Next


    Comment

    • Cor Ligthert [MVP]

      #3
      Re: Is this Possible ?

      Peter,

      It is not impossible, hundreds have been before you asking this.

      My answer is standard, be aware that you can never fullfil the wishes of
      your clients as they are fullfilled with ms-access.

      For the rest is it just a bunch of work especially in a way that your user
      will understand it and therefore it is as well endless work.

      Cor

      "Peter Newman" <PeterNewman@di scussions.micro soft.com> schreef in bericht
      news:0A327452-17D3-45D8-BE9B-31FBF5C657A8@mi crosoft.com...[color=blue]
      >I would like to attempt to create a dynamic form. The scenerio is when a
      >user
      > logs onto the system, it will get a list of 'Areas' in the application
      > that
      > the user has permission to enter. I want to dynamicly add buttons on the
      > form ( in two coloums 8 to a coloum ) and have an 'click' event. Also
      > i
      > would like to be able to change the 'text' of the button.. can anybody
      > show
      > me the basics please or a good tutorial[/color]


      Comment

      • Larry Lard

        #4
        Re: Is this Possible ?


        Stuart Nathan wrote:[color=blue]
        > Something like this and from memory only
        >
        > Public Event Clicked( byval Value as String)
        > Private Btn(6) as Windows.Forms.B utton (check this?)
        >
        > Private Sub HaveBeenClicked ( can't remember arguments, but must be the same
        > as click event)
        >
        > code here..
        > RaiseEvent Clicked( text)
        >
        > End Sub
        >
        > Public Sub Form_Load()
        > For i as integer=0 to 6
        > Btn(i)=New Button
        > AddHandler Btn(i).Click, Addressof HaveBeenClicked
        > Next[/color]

        I'm sorry, I can't tell from that pseudo code what it is you are
        actually trying to do, and without knowing that I'm reluctant to offer
        advice.

        --
        Larry Lard
        Replies to group please

        Comment

        • Brian Gideon

          #5
          Re: Is this Possible ?

          Stuart,

          I'm with Larry on this one. Can you explain what it is you want to do?

          Brian

          Stuart Nathan wrote:[color=blue]
          > Something like this and from memory only
          >
          > Public Event Clicked( byval Value as String)
          > Private Btn(6) as Windows.Forms.B utton (check this?)
          >
          > Private Sub HaveBeenClicked ( can't remember arguments, but must be the same
          > as click event)
          >
          > code here..
          > RaiseEvent Clicked( text)
          >
          > End Sub
          >
          > Public Sub Form_Load()
          > For i as integer=0 to 6
          > Btn(i)=New Button
          > AddHandler Btn(i).Click, Addressof HaveBeenClicked
          > Next[/color]

          Comment

          • Cor Ligthert [MVP]

            #6
            Re: Is this Possible ?

            Brian and Lary,

            In my idea has Stuart all the basics suplied which the OP was asking for.
            [color=blue][color=green]
            >> Something like this and from memory only[/color][/color]
            Read this as in runtime, just one word.[color=blue][color=green]
            >>
            >> Public Event Clicked( byval Value as String)[/color][/color]

            This is not really needed but it can be done this way as Stuart does
            [color=blue][color=green]
            >> Private Btn(6) as Windows.Forms.B utton (check this?)[/color][/color]

            This is creation global the placeholder of the seven buttons, nothing wrong
            with even in real code
            [color=blue][color=green]
            >> Private Sub HaveBeenClicked ( can't remember arguments, but must be the
            >> same
            >> as click event)[/color][/color]
            This is the click event that is needed
            [color=blue][color=green]
            >>
            >> code here..
            >> RaiseEvent Clicked( text)[/color][/color]
            this reases an event on an event so not really needed it can be handled
            direct
            [color=blue]
            > End Sub[color=green]
            >>
            >> Public Sub Form_Load()
            >> For i as integer=0 to 6
            >> Btn(i)=New Button
            >> AddHandler Btn(i).Click, Addressof HaveBeenClicked
            >> Next[/color][/color]
            This is the initializing of the button and setting the handler as the OP was
            asking.

            Something as it is on our website like this.



            Where there are more advanced samples about this as well on our website

            :-)

            Cor


            Comment

            • Stuart Nathan

              #7
              Re: Is this Possible ?

              What I was trying to do was to give some idea of the way forward for Peter
              Newman to look at. I don't understand what you mean by 'pseudo code' and
              therefore being unable to comment. If that is how people react then I won't
              bother to try and help in future.


              Comment

              • Mark Lincoln

                #8
                Re: Is this Possible ?

                Stuart:

                I'm looking at this via Google. Your post is first, with no quoted
                text and no reference to Mr Newman, and thus appears to be a question
                rather than an answer. I think this may be why the other posters were
                confused--they couldn't make sense of your "question" which really
                wasn't.

                I'm confused because I'm a VB.NET newbie, but that's not the issue
                here. :-)

                Stuart Nathan wrote:[color=blue]
                > What I was trying to do was to give some idea of the way forward for Peter
                > Newman to look at. I don't understand what you mean by 'pseudo code' and
                > therefore being unable to comment. If that is how people react then I won't
                > bother to try and help in future.[/color]

                Comment

                • Brian Gideon

                  #9
                  Re: Is this Possible ?

                  Stuart,

                  I think it's a misunderstandin g. I'm sure Larry thought you were the
                  original poster. I know I did because your post appears to have
                  started a new thread. I didn't realize your post was in response to
                  another question and so having no context I was confused.

                  Pseudocode is a term used to describe a portion of a program that uses
                  high level constructs, but omits certain language specific details for
                  brevity.

                  I hope you understand that our responses weren't meant to offend.
                  Instead we were just trying to get more information.

                  Brian

                  Stuart Nathan wrote:[color=blue]
                  > What I was trying to do was to give some idea of the way forward for Peter
                  > Newman to look at. I don't understand what you mean by 'pseudo code' and
                  > therefore being unable to comment. If that is how people react then I won't
                  > bother to try and help in future.[/color]

                  Comment

                  • Stuart Nathan

                    #10
                    Re: Is this Possible ?

                    OK - No problem.

                    My own experience is that answers to non specific questions need to try to
                    explain the principals as I have found them, So adding buttons dynamically
                    is no problem. Simply use .SetBounds to position them and .Controls.Add or
                    ..AddRange to add them. Their other properties you will need to set in code.
                    To add events then use AddHandler.


                    Comment

                    Working...