Converting it to VB

Just to tie the previous two blog posts together, I copied the C# into Instant VB and here is what it spit out (line break added to fit)

Private Sub AnyPropertyCheckBox_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Dim isVisible As Nullable(Of Boolean) = Not AnyPropertyCheckBox.IsChecked
    For Each uie As UIElement In LayoutRoot.Children
        Dim cb As CheckBox = TryCast(uie, CheckBox)
        If cb IsNot Nothing Then
            If cb.Tag IsNot Nothing AndAlso cb.Tag.ToString().ToUpper() = "SEARCHCRITERIA" Then
                cb.Visibility = If(isVisible.GetValueOrDefault() = True, _
Visibility.Visible, Visibility.Collapsed) End If ' end if tag match End If ' end if check box Next uie ' end for each element End Sub ' end method

About Jesse Liberty

Jesse Liberty has three decades of experience writing and delivering software projects and is the author of 2 dozen books and a couple dozen online courses. His latest book, Building APIs with .NET will be released early in 2025. Liberty is a Senior SW Engineer for CNH and he was a Senior Technical Evangelist for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS. He is a Microsoft MVP.
This entry was posted in z Silverlight Archives. Bookmark the permalink.