I have the following code:
Private Sub txtFileFromLocation_TextChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.TextChangedEventArgs)
MachineNameUIDisabled()
ServiceNameUIDisabled()
ToLocationUIDisabled()
btnSubmitUIDisabled()
lblStatusClear()
End Sub
Private Sub txtMachineName_TextChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.TextChangedEventArgs)
ServiceNameUIDisabled()
ToLocationUIDisabled()
btnSubmitUIDisabled()
lblStatusClear()
End Sub
Private Sub txtServiceName_TextChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.TextChangedEventArgs)
ToLocationUIDisabled()
btnSubmitUIDisabled()
lblStatusClear()
End Sub
Private Sub txtFilesToLocation_TextChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.TextChangedEventArgs)
btnSubmitUIDisabled()
lblStatusClear()
End Sub
I am looking to consolidate this into one sub without having any repeating code (all subs currently hold btnSubmitUIDisabled() and lblStatusClear())
I thought about a CASE statement but that would also have repetitive code. This is a WPF application and all the “TextChanged” events are located in the xaml, thus no “Handles” at the end of each sub.
Thanks in advance.
Well for one thing you can cascade the calls:
I would personally name them differently at that point – make the method say what it does rather than what it reacts to – but that’s just a long-running difference of opinion between myself and Visual Studio.