|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
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 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 Stuart Nathan wrote:
Show quoteHide quote > Something like this and from memory only I'm sorry, I can't tell from that pseudo code what it is you are> > 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 actually trying to do, and without knowing that I'm reluctant to offer advice. -- Larry Lard Replies to group please 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 Nathan wrote: Show quoteHide quote > 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 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 Stuart Nathan wrote: Show quoteHide quote > 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. 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. Stuart,
I'm with Larry on this one. Can you explain what it is you want to do? Brian Stuart Nathan wrote: Show quoteHide quote > 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 Brian and Lary,
In my idea has Stuart all the basics suplied which the OP was asking for. >> Something like this and from memory only Read this as in runtime, just one word.>> This is not really needed but it can be done this way as Stuart does>> Public Event Clicked( byval Value as String) >> Private Btn(6) as Windows.Forms.Button (check this?) This is creation global the placeholder of the seven buttons, nothing wrong with even in real code >> Private Sub HaveBeenClicked( can't remember arguments, but must be the This is the click event that is needed>> same >> as click event) >> this reases an event on an event so not really needed it can be handled >> code here.. >> RaiseEvent Clicked( text) direct > End Sub This is the initializing of the button and setting the handler as the OP was >> >> Public Sub Form_Load() >> For i as integer=0 to 6 >> Btn(i)=New Button >> AddHandler Btn(i).Click, Addressof HaveBeenClicked >> Next 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 :-) CorPeter,
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 Show quoteHide quote "Peter Newman" <PeterNew***@discussions.microsoft.com> schreef in bericht news:0A327452-17D3-45D8-BE9B-31FBF5C657A8@microsoft.com... >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
The big Debate on DoEvents
How to easily create useful data-entry forms in vb.net? Changing datagridview cell borders at runtime best way for Replace insensitive in strings How do you see if a table already exists in a database? DataBase Programming How to easily create data-entry forms in vb.net How can I get Windows user, password and domain? How to use Compressed Folder function of XP programmatically? working with time only |
|||||||||||||||||||||||