We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Opening a form from a grid event

Hi, I am currently trying to invoke a form to load from the current cell validated on a grid. When the Show() method of the form is reached the application stop responding. I have the included some sample code below. The form is a new instance of the current form. private void gridQuestions_CurrentCellValidated(object sender, System.EventArgs e) { this.hasEdits=true; GridCurrentCell cc = this.gridQuestions.CurrentCell; if (gridQuestions[cc.RowIndex,cc.ColIndex].CellType=="ComboBox") { GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer; if (typeof(dsHouses.QuestionLinkedListValuesRow)==cr.ListBoxPart.SelectedItem.GetType()) { dsHouses.QuestionLinkedListValuesRow llv= cr.ListBoxPart.SelectedItem as dsHouses.QuestionLinkedListValuesRow; if (llv!=null&&!llv.IsQuestionLinkedQuestionGroupIdNull()) { Total_Cost.frmHouseQuestions ch = new frmHouseQuestions(this.objdsHouses,llv.QuestionLinkedQuestionGroupId); ch.MdiParent=this.MdiParent; ch.Show(); } } } } Thanks, Craig

2 Replies

AD Administrator Syncfusion Team December 12, 2002 11:51 PM UTC

Does it help if you call grid.CancelUpdate(); just before calling ch.Show()? The grid might be in between Begin/EndUpdate calls while this event is raised and because of that Paint messages are ignored which causes some side unwanted effects when showing a dialog. (Something we would have to review again and change in future). Stefan


RJ Robert J Harder December 13, 2002 01:26 AM UTC

Ok calling CancelUpdate() didn't work, the app stopped responding at this point instead. I have now hung this off the CurrentCellEditingCompleteEvent. The form now opens as expected.

Loader.
Up arrow icon