RUNTIME Menu from a txt file?

  • 13 years ago

    Hello again everyone,

    its been a while lol ope evryone is ok, i have a question regarding building a menu at runtime froma txt file. I have been asked to create a button set ie 6 buttons that get there name.text and there event handler from a txt file, so that the 6 buttons can be changed dynamically.

    As far as im awar a normal menu that is built at runtime is created by using event handlers the button calls the method and then executes the event.

    Does anyone have any solid ideas of how i can create my dynamic button menu using a txt file?

    Mant Thanks


  • 13 years ago
    Getting the text to display on a Button from a text file is quite reasonable because the Text property is type String.  I don't see how you can specify an event handler in a text file though.  An event handler is a method and the available methods are compiled into the application.  How can you pass in an event handler from a text file?
  • 13 years ago

    Its a horrible hack, but if the possible event handlers are documented, its possible.

    Assume you have 3 handlers:





    What you do is create a button on the fly, or 'make visible' one or more of 6 buttons that already exist on your form.

    In their Click event, just use a select ... case statement to check which event handler you want to use.

    select case strEvenet

    case "Calc"

    call DoCalc()

    case "Write"

    call DoWrite()




  • 13 years ago

    Great stuff i have done what you advised and it works great.

     Thanks for your help


Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Linux is only free if your time has no value” - Jamie Zawinski