<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Noob with Event Help please in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/noob-with-event-help-please/m-p/3664644#M52980</link>
    <description>&lt;P&gt;I find my little bug.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have add the removehandler in my finalyse of the form but this sub is never call.&lt;/P&gt;&lt;P&gt;so i move it to the sub in .designer of the form see below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;System.Diagnostics.DebuggerNonUserCode()&amp;gt; _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                RemoveHandler ClassDef0_StyleGeneral.EventBoiteOpMaJ, AddressOf EventBoiteOpMaJ

                DefBlocEnCours = Nothing
                DefConfigEnCours = Nothing
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;so the question how i can override this sub in my form ? i can move the sub in my form ? I cant override it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How i can force autocad to pass in it ? i use form.dispose so if i use it, finalize is never call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Oct 2012 11:19:37 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-10-18T11:19:37Z</dc:date>
    <item>
      <title>Noob with Event Help please</title>
      <link>https://forums.autodesk.com/t5/net-forum/noob-with-event-help-please/m-p/3651606#M52977</link>
      <description>&lt;P&gt;Hi, i am totaly new with Event in VB.net.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So : my project :&lt;/P&gt;&lt;P&gt;One class with a lot of collection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a MDIFORM for show all stuff inside this class.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so in the class if i add a new object in a collection (ex : block) if want to raise a event .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Child Form receive this event and adjust the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for this&amp;nbsp; my code :&lt;/P&gt;&lt;P&gt;Inside my class :&lt;/P&gt;&lt;PRE&gt; '-------------------------------------------------------------------------
    '------ Ajout d'un Bloc --------------------------------------------------
    '-------------------------------------------------------------------------
    ' ENTREE
    '    DefBloc : La référence du bloc à traiter (ObjectId)
    ' SORTIE
    '    Le pointeur du nouveau Bloc
    '-------------------------------------------------------------------------
    Public Function AddBloc(ByRef DefBloc As Object, ByVal Debug As Boolean) As ClassDef0f_Bloc

        Dim DefRetour As ClassDef0f_Bloc
        DefRetour = New ClassDef0f_Bloc(DefBloc(GestionAUTOCAD.Enum_GA_GSFB.Nom))
        If DefRetour.ExtractionAtt(DefBloc, Debug) = True Then
            Try
                'ajout à la collection
                DefRetour.ClassBase = Me
                cCollBloc.Add(DefRetour, DefRetour.Nom)
                'MaJ des FenetreConfig
                RaiseEvent EventBlocNew(DefRetour.Nom)
                Return DefRetour

            Catch ex As Exception
                'erreur car déjà existant
                DefRetour.Dispose()
                DefRetour = Nothing
                MsgBox("Ce nom de bloc existe déjà !", MsgBoxStyle.Information, "Erreur Utilisateur")
                Return Nothing
            End Try
        Else
            'erreur à la création
            DefRetour.Dispose()
            DefRetour = Nothing
            MsgBox("Erreur à l'extraction des attributs", MsgBoxStyle.Information, "Erreur Systeème")
            Return Nothing
        End If
    End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;--&amp;gt; i raise the évent EventBlocNew&lt;/P&gt;&lt;P&gt;this event is : Shared Event EventBlocNew(ByVal Nom As String)&amp;nbsp;&amp;nbsp;&amp;nbsp; in this class&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So in my form :&lt;/P&gt;&lt;P&gt;in the new : AddHandler ClassDef0_StyleGeneral.EventBoiteOpNew, AddressOf EventBoiteOpNew&lt;/P&gt;&lt;P&gt;in the finalize : RemoveHandler ClassDef0_StyleGeneral.EventBoiteOpNew, AddressOf EventBoiteOpNew&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i retrieve the event :&lt;/P&gt;&lt;P&gt;Protected Sub EventBlocNew(ByVal Nom As String)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim columnB As Windows.Forms.DataGridViewComboBoxColumn = Nothing&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; columnB= DataGridViewCalque.Columns(EnumCalque.Bloc)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; columnB.Items.Remove(Nom)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so all my code woks fine in the fist loaded project (in autocad)&amp;nbsp; but when i quit and launch this&amp;nbsp; the code in Protected Sub EventBlocNew(ByVal Nom As String)&amp;nbsp;&amp;nbsp; crash..&lt;/P&gt;&lt;P&gt;--&amp;gt; Windows.Forms.DataGridViewComboBoxColumn --&amp;gt; 0 items...&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WHY !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have tested the sub with a object reference of my MDIForm . (by ref F as object,)&amp;nbsp; -&amp;gt; so i check the num of columns and i have not 0&amp;nbsp; so&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with the event i am not in the actual MDIChild Form ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I dont understand this..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2012 11:35:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/noob-with-event-help-please/m-p/3651606#M52977</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-09T11:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Noob with Event Help please</title>
      <link>https://forums.autodesk.com/t5/net-forum/noob-with-event-help-please/m-p/3661244#M52978</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest&amp;nbsp;placing a breakpoint in the constructor and running it twice to simulate that condition.&lt;/P&gt;
&lt;P&gt;If another instance is getting created for some reason, breakpoint in the form constructor should get hit and then you can find out from where it is getting called using the call stack.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can provide a minimal sample project demonstrating the behavior, I can have a look at it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2012 12:51:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/noob-with-event-help-please/m-p/3661244#M52978</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2012-10-16T12:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Noob with Event Help please</title>
      <link>https://forums.autodesk.com/t5/net-forum/noob-with-event-help-please/m-p/3664608#M52979</link>
      <description>&lt;P&gt;thx. i do that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I dont know why with the event i dont have th correct value of my Datagridview..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i you can share your example for event. i appreciate.&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2012 10:38:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/noob-with-event-help-please/m-p/3664608#M52979</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-18T10:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: Noob with Event Help please</title>
      <link>https://forums.autodesk.com/t5/net-forum/noob-with-event-help-please/m-p/3664644#M52980</link>
      <description>&lt;P&gt;I find my little bug.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have add the removehandler in my finalyse of the form but this sub is never call.&lt;/P&gt;&lt;P&gt;so i move it to the sub in .designer of the form see below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;System.Diagnostics.DebuggerNonUserCode()&amp;gt; _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                RemoveHandler ClassDef0_StyleGeneral.EventBoiteOpMaJ, AddressOf EventBoiteOpMaJ

                DefBlocEnCours = Nothing
                DefConfigEnCours = Nothing
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;so the question how i can override this sub in my form ? i can move the sub in my form ? I cant override it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How i can force autocad to pass in it ? i use form.dispose so if i use it, finalize is never call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2012 11:19:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/noob-with-event-help-please/m-p/3664644#M52980</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-18T11:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: Noob with Event Help please</title>
      <link>https://forums.autodesk.com/t5/net-forum/noob-with-event-help-please/m-p/3664682#M52981</link>
      <description>&lt;P&gt;Glad you have found the issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How about using the FormClosing or FormClosed event to remove the handler ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2012 11:52:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/noob-with-event-help-please/m-p/3664682#M52981</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2012-10-18T11:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: Noob with Event Help please</title>
      <link>https://forums.autodesk.com/t5/net-forum/noob-with-event-help-please/m-p/3666388#M52982</link>
      <description>&lt;P&gt;i cant do that.&lt;/P&gt;&lt;P&gt;it is a MDI Chid so i close the form but i reopen after... or i have to add handle in open event.&lt;/P&gt;&lt;P&gt;yes.. i cant do that.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Oct 2012 10:24:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/noob-with-event-help-please/m-p/3666388#M52982</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-19T10:24:56Z</dc:date>
    </item>
  </channel>
</rss>

