0

Good day,

I have a problem in an MDI form, have the main form, and have 2 buttons, these buttons lead to children forms, one of the forms allows you to select a category from a database, and fills the grid within the, everything works until I I embed the form within the MDI using the button that event is as follows:

Private Sub ButtonCatego_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles ButtonCatego.ItemClick
    Dim addCategory As New AddCategory
    addCategory.MdiParent = Me.MdiParent
    addCategory.Show()
End Sub

When i use the normal event works:

Private Sub ButtonCatego_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles ButtonCatego.ItemClick
    AddCategory.Show()
End Sub

Help me please. Thank you

1 Answers1

0

You are setting addCategory.MdiParent to your current form's MDI parent. If Me is your main form then it won't have an MDI parent, which is why you're not getting it to work.

Set addCategory.MdiParent to Me instead and it should resolve your issue:

Private Sub ButtonCatego_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles ButtonCatego.ItemClick
  Dim addCategory As New AddCategory()
  addCategory.MdiParent = Me      
  addCategory.Show()

End Sub
Visual Vincent
  • 18,045
  • 5
  • 28
  • 75
  • You should rather add an explanation about what he missed/what he did wrong instead of just saying something similar to "Try this" or "This works". – Visual Vincent Aug 25 '16 at 06:50