Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WinForms - object access
Message
De
11/06/2009 12:49:02
 
Information générale
Forum:
ASP.NET
Catégorie:
Programmation orienté objet
Versions des environnements
Environment:
VB 8.0
Divers
Thread ID:
01405232
Message ID:
01405257
Vues:
42
>Hi All,
>
>How do I have to declare a textbox objects on a form in order to modify it within a function which gets the object name from evaluating a condition?
>
>As a result I would like to change the background color of an existing object.
>
>
>Private Sub CheckForHolidaySeason(ByVal TodayDate As Date)
>
>        Dim i As Integer = 1
>        Dim wkNumber As Integer = 1
>        Dim dDate As Date = TodayDate
>        Dim objName As New TextBox
>
>        While i <= 52
>            'display current values
>            'MsgBox(i)
>            'MsgBox(wkNumber)
>            'MsgBox(dDate)
>
>'check if dDate falls into the Holiday period (wks: 48,49,50,51,52,53)
>            If DatePart(DateInterval.WeekOfYear, dDate) = 48 _
>                Or DatePart(DateInterval.WeekOfYear, dDate) = 49 _
>                Or DatePart(DateInterval.WeekOfYear, dDate) = 50 _
>                Or DatePart(DateInterval.WeekOfYear, dDate) = 51 _
>                Or DatePart(DateInterval.WeekOfYear, dDate) = 52 _
>                Or DatePart(DateInterval.WeekOfYear, dDate) = 53 Then
>
>                'define object name
>                objName.Name = "txtW" & Trim(wkNumber.ToString)
>                objName.BackColor = Color.Green
>
>            End If
>
>            'increase variables
>            dDate = dDate.AddDays(7)
>            wkNumber += 1
>            i += 1
>
>        End While
>    End Sub
>
>
>Thank you,
>Daniel

http://www.codeproject.com/KB/vb/getControlFromName.aspx ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform