| | | 
StrataFrame User
       
Group: StrataFrame Users Last Login: 11/25/2008 10:33:22 AM Posts: 318, Visits: 460 |
| | If I have a form with multiple tabs on it, and there is an error on a tab not focused...is there a way to focus the tab with the error on it automatically? |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Yesterday @ 7:08:30 PM Posts: 4,811, Visits: 4,781 |
| | Right now there is not a way to do this automatically. But you can tie this in failry easy. Below is a sample of one possible way to achieve this. I did not test this code, but you should get the general idea. Private Sub MyBO_BusinessRulesChecked(ByVal e As MicroFour.StrataFrame.Business.BusinessRulesCheckedEventArgs) Handles MyBO.BusinessRulesChecked'-- Establish Locals Dim loRule As MicroFour.StrataFrame.Business.BrokenRule Dim loControl As System.Windows.Forms.ControlIf e.CountOfBrokenRulesTotal > 0 Then
'-- Get the first broken rule loRule = MyBO.BrokenRules.ToArray()(0)'-- Cycle through all of the controls on the form For Each loControl In Me.Controls '-- See if the control supports the IBusinessBindable interface (SF Binding) If loControl.GetType().GetInterface("IBusinessBindable") IsNot Nothing Then '-- See if the control matches the field name in error If CType(loControl, MicroFour.StrataFrame.UI.Windows.Forms.IBusinessBindable).BindingField.Equals(loRule.FieldName, StringComparison.OrdinalIgnoreCase) Then '-- Set the focus loControl.Focus() '-- Exit the loop Exit For End If End If NextEnd IfEnd Sub |
| | | | 
StrataFrame User
       
Group: StrataFrame Users Last Login: 11/25/2008 10:33:22 AM Posts: 318, Visits: 460 |
| | Thanks Trent, I'll give that a try. |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Yesterday @ 7:08:30 PM Posts: 4,811, Visits: 4,781 |
| | Sure. Like I said, I did not test the code and you might have to make minor change here or there, but this should at least get you started. |
| |
|
|