Click here to Skip to main content
15,919,341 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all, in my projcet i have created some N of labels at runtime,
when certain contion meet i ll change the image of that label control, but i can't change image of that control
this is the coding i am using for that task


VB
cb.Name = fmsrs.item("seatname")
                       For Each c As Control In Me.Controls
                           If TypeOf c Is Label Then
                               If cb.Name = c.Name Then
                                   p = p + 1
                                   ' c.Text = fmsrs.item("seattext")
                                   c.Enabled = False

                                   c.Font = New System.Drawing.Font("Times New Roman", 7.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
                                   c.ForeColor = Color.Yellow
                               Else
                               End If
                           End If




how can i place iamge for label contol's in above coding :)
Posted

1 solution

This is going to depend on how you have arranged your form:

If your labels are directly on the form, then you can access then that way.

If they aren't - if they are in a panel, or a group box, or a tab page, or... etc. then they are not directly added to the form Controls list. Instead, you will need to recursively check the Controls list for each Control on your form.
 
Share this answer
 
Comments
sameertm 11-Dec-10 5:16am    
my controls are form only, i didn't use any panel or anything,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900