Child Form not refreshing when i try to start the app from MDI form?
I have MDI form and child forms in my app. Here my situation...
Main Form : MDI Form Register Form : Child of MDI form Desig form : another form which will open when we will click one button on Register form.
now if i try to refresh the items of combo box of Register form from Desig form, then it is not refreshing. i.e. i can't see my new items in that combo box on Register form.
Now when i try to start my app directly from Register form then the same code works perfectly but same code is not running when i try to start the app from MDI form.
here is my codes. MDI Form :
Dim regform As New Register StatusLabel.Text = "Opening Workman Registration" regform.MdiParent = Me regform.Show() StatusLabel.Text = "Workman Registration" regform.concombo.Focus()
Public Sub refreshCombo() desigcombo.Items.Clear() sitecombo.Items.Clear() addDesCombo() ' method which will loads all new data from database desigcombo.Text = designame ' the string variable (designame) End Sub
Register.refreshCombo() ' will run when we will click on one button.
so is their any thing which need to remember when we using MDI form - Child Form?
When you refresh Register from Desig, it works when you start the app from Register because there is only one Register form and VB automatically considers it an instance of the form.
When the register form is a child form, you need to use the instance of the form rather than the class name, something like MainForm.ActiveMdiChild.refreshCombo()