Is this Possible ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Something like this and from memory only

Public Event Clicked( byval Value as String)
Private Btn(6) as Windows.Forms.Button (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
 
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
 
Stuart said:
Something like this and from memory only

Public Event Clicked( byval Value as String)
Private Btn(6) as Windows.Forms.Button (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

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.
 
Stuart,

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

Brian
 
Brian and Lary,

In my idea has Stuart all the basics suplied which the OP was asking for.

This is not really needed but it can be done this way as Stuart does

This is creation global the placeholder of the seven buttons, nothing wrong
with even in real code
This is the click event that is needed
this reases an event on an event so not really needed it can be handled
direct
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.

http://www.vb-tips.com/default.aspx?ID=e7510e67-92f3-49f6-b902-03abce36aa60

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

:-)

Cor
 
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.
 
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,

I think it's a misunderstanding. 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
 
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.
 
Back
Top