Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why the Method does not fire?
Message
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
01235347
Message ID:
01235358
Vues:
16
I don't think the code here is the problem. I think that the code in your parent's form is. How do you attach the event of the child to a method in the parent's form? It has to be attached to the correct instance of the child form.


>Hi all!
>
>I got a child form that is called to add record to the backend, after add the record it refresh the grid that is the parent form. WHen I finished add record it refresh the parent form fine but If i call the child form again it stop refreshing the parent form. Why? Here is the code of the child form.
>
>
>Public Class DepartmentADD
>    Event Fill_Parent_Grid()
>
>    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
>
>        RaiseEvent Fill_Parent_Grid()
>        Me.Close()
>    End Sub
>
>    Private Sub DepartmentADD_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
>        'TODO: This line of code loads data into the 'DepartmentsDataSet.Departments' table. You can move, or remove it, as needed.
>        'GJP commented because I dont want the dataset to fill the form.
>        ' Me.DepartmentsTableAdapter.Fill(Me.DepartmentsDataSet.Departments)
>        Me.Dept_AbbTxt.BackColor = My.Settings.Color7
>        Me.Dept_nameTXT.BackColor = My.Settings.Color7
>        Me.BackColor = My.Settings.Color5
>        Me.Dept_nameTXT.Focus()
>    End Sub
>
>    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
>        If Len(Trim(Me.Dept_nameTXT.Text)) = 0 Then
>            MessageBox.Show("The value of the Department Name can't be empty")
>            Return
>        End If
>        If Len(Trim(Me.Dept_AbbTxt.Text)) = 0 Then
>            MessageBox.Show("The value of the Department Abbreviation can't be empty")
>            Return
>        End If
>        'Me.Dept_SqlCommand.Parameters("@Dept_Pk").Value = Me.Dept_PkTxt.Text
>        Me.Dept_SqlCommand.Parameters("@Dept_abr").Value = Me.Dept_AbbTxt.Text
>        Me.Dept_SqlCommand.Parameters("@Dept_Name").Value = Me.Dept_nameTXT.Text
>        Try
>            Me.Department_SCN.Open()
>            Me.Dept_Sqlcommand.ExecuteNonQuery()
>            Me.Department_SCN.Close()
>            Me.Disp_Msg.Text = Trim(Me.Dept_nameTXT.Text) + " Added"
>            Me.Dept_AbbTxt.Clear()
>            Me.Dept_nameTXT.Clear()
>        Catch ex As Exception
>            MessageBox.Show(ex.ToString)
>            Me.Department_SCN.Close()
>        End Try
>        RaiseEvent Fill_Parent_Grid()
>        Me.Dept_nameTXT.Focus()
>    End Sub
>
>End Class
>
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform