Results 1 to 6 of 6

Thread: [RESOLVED] Adding controls from Database on formLoad

Threaded View

  1. #1

    Thread Starter
    New Member < Sal >'s Avatar
    Join Date
    Oct 2009
    Location
    Sydney, Australia
    Posts
    6

    Resolved [RESOLVED] Adding controls from Database on formLoad

    Hi all,
    INTRO
    My first post here so ill just give a brief intro and appology for this informal post.
    I'm a junior programmer and keen to learn, from Australia, 18yrs old.


    Problem
    ok so to the problem i've got.
    I want my application to be able to be changed by the user.
    For example on my form I have the labels Blue, Red and Green but the user requires yellow and another colour which is unkown to me so they would have an ADD function which saves to the database so next time they login their colours are there as labels.

    How would you pick up the name of the colour from the database? and place that into your code to create a dynamic control with the same name as the colour which is unkown?

    Is there a way of changing a variable name?
    I went about it this way but am getting stuck:
    Code:
    Dim SQL As String
            SQL = "select * from Colours where type ='control' "
            Dim dt As DataTable = DAC.ExecuteQuery(SQL)
            Dim dr As DataRow
            Dim i As Integer = 0
            Dim controlName As System.Windows.Forms.Label()
            While i < dt.Rows.Count
                dr = dt.Rows(i)
                controlName = dr("Name")
    '' I want controlName to be changed
    
                i = i + 1
            End While
    So if there is any better or other way that works please and thank you.

    Cheers
    Last edited by < Sal >; Oct 13th, 2009 at 12:31 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width