PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You write the following code fragment.
<StackPanel TextBox.PreviewTextInput=”StackPanel_PreviewTextInput”>
<TextBox Name=”TxtBoxA”/>
<TextBox Name=”TxtBoxB”/>
<TextBox Name=”TxtBoxC”/>
</StackPanel>

You create an event handler named StackPanel_PreviewTextInput. You also have a collection of strings named Keywords. You need to ensure that TxtBoxA and TxtBoxB do not contain any of the strings in the Keywords collections. Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
Private Sub StackPanel_PreviewTextInput(sender As Object, e As TextCompositionEventArgs) Dim feSource As FrameworkElement = TryCast(sender, FrameworkElement) If feSource.Name = “TxtBoxA” OrElse feSource.Name = “TxtBoxB” Then For Each keyword As String In Keywords If e.Text.Contains(keyword) Then e.Handled = False Return End If Next e.Handled = True End If End Sub

B.
Private Sub StackPanel_PreviewTextInput(sender As Object, e As TextCompositionEventArgs) Dim feSource As FrameworkElement = TryCast(e.Source, FrameworkElement) If feSource.Name = “TxtBoxA” OrElse feSource.Name = “TxtBoxB” Then For Each keyword As String In Keywords If e.Text.Contains(keyword) Then e.Handled = False Return End If Next e.Handled = True End If End Sub

C.
Private Sub StackPanel_PreviewTextInput(sender As Object, e As TextCompositionEventArgs) Dim feSource As FrameworkElement = TryCast(sender, FrameworkElement) If feSource.Name = “TxtBoxA” OrElse feSource.Name = “TxtBoxB” Then For Each keyword As String In Keywords If e.Text.Contains(keyword) Then e.Handled = True Return End If
For interactive and self-paced preparation of exam 70-521, try our practice exams.
Practice exams also include self assessment and reporting features! Next e.Handled = False End If End Sub

D.
Private Sub StackPanel_PreviewTextInput(sender As Object, e As TextCompositionEventArgs) Dim feSource As FrameworkElement = TryCast(e.Source, FrameworkElement) If feSource.Name = “TxtBoxA” OrElse feSource.Name = “TxtBoxB” Then
For Each keyword As String In Keywords If e.Text.Contains(keyword) Then e.Handled = True Return End If Next e.Handled = False End If End Sub


Leave a Reply