Adding controls during runtime problem

  • 12 years ago

     Hello guys, i'm new to this forum so hi.

    I'm here with my first problem. I'm in my last year of high school, and I need to create a program for a pay-desk.

    now, i was planning on adding controls depending on the user that logs in.

    so i was writing a procedure to add the controls for eg the manager.

    And i tried the following:

    Dim lstTables as new listbox

    me.controls.add(lstTables)

    it still works at this point, but it goes wrong with the following:

    lstTables.Location.X(10)

    the error message says: property acces must assign to the property or use it's value.

     

    How can i change the size, location etc? Ive tried everything i know about controls, it should work i think because isnt it the same as 'button.text = "" ' ?

     

    Grtz, m1dnight 

  • 12 years ago

    Try

    Dim lstTables as new listbox()
    lstTables.Location = New Point(10,10)
    me.Controls.Add(lstTables)

     

    A simpler way for your project might be, to add all the controls and hide the controls from the user that logs in.

     

Post a reply

Enter your message below

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

Contribute

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.

“Walking on water and developing software from a specification are easy if both are frozen.” - Edward V Berard