Dynamic synchronization between winform controls and GridGroupingControl
Private Sub GridGroupingControl1_TableControlCurrentCellCloseDropDown(sender As Object, e As GridTableControlPopupClosedEventArgs) Handles GridGroupingControl1.TableControlCurrentCellCloseDropDown
If e.TableControl.CurrentCell.Renderer.Model.Description = "GridComboBoxCellModelDesc" Then
Dim renderer As GridComboBoxCellRenderer = GridGroupingControl1.TableControl.CurrentCell.Renderer
If (renderer.ColIndex = 1) Then
ComboBoxNameInControls.SelectedIndex = renderer.ListBoxPart.SelectedIndex
End If
End sub
This
This triggers the SelectedIndex event for the Winform ComboBox (Private Sub ComboBoxNameInControl_SelectedIndexChanged (sender as object, e As EventArgs) Handles ComboBoxNameInControl.SelectedIndexChanged) and update it dynamically.
I have 3 questions related to this:
1) what procedures shall I follow to do the same with textboxes (on each side)
2) what event shall I pick on each side (WinForm and GGC) to get a perfectly synchronized form - and is it possible to avoid an event for each and every control (a more general approach)
3) I have an audit trail on the GGC side, with an event "GridGroupingControl1_RecordValueChanging" : is it possible to fire this event whenever a change is made on the WinForm controls side?
Thanks in advance!!! - Nicolas
I installed an older version of VS to understand your programming, and I saw the difference : the ENTER key press is what's updating from GRID to CTL (triggering the SourceListListChanged) - so basically, it now works both ways for the updating, I added an event where I generate an ENTER in the grid for the users that do not press enter ENTER for each field - that yields the same result
Private Sub GridGroupingControl1_TableControlCurrentCellValidating(sender As Object, e As GridTableControlCancelEventArgs) Handles GridGroupingControl1.TableControlCurrentCellValidating
SendKeys.Send("{ENTER}")
End Sub
As for your question, I use the validating event in the Textbox for the same users that do not press ENTER, but rather change Textbox when they are finished completing one, it is not as instantaneous as the Key press event (your event is better in that point of view, as long as the user is using the key press...), but basically the job is done
Private Sub oTraining_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles oTraining.Validating
Call modMain.DynamicCTLToGGC(GridGroupingControl1, "otraining", oTraining.Text) 'This is the program lines you made I placed in a sub
'Here raise the event : GridGroupingControl1_RecordValueChanging
End Sub
Now, the RecordValueChanging is an important event for me as it yields the Audit Trail sub as follows :
Private Sub GridGroupingControl1_RecordValueChanging(sender As Object, e As RecordValueChangingEventArgs) Handles GridGroupingControl1.RecordValueChanging
Call modMain.AuditTrailGGC(GridGroupingControl1, sender, e, "Edit", Me.PID.Text)
End Sub
As I explained earlier, the RecordValueChanging is triggered easily whenever the user is changing values in the grid. However, I am still missing the piece that will trigger this event whenever a user is changing data from the windows' controls
All the best! - Nicolas
- Nicolas
- 12 Replies
- 2 Participants
-
NI Nicolas
- Jun 20, 2016 06:14 PM UTC
- Jun 28, 2016 04:49 AM UTC