I erased all the code that I copied from the tutorial and added the following to my Public Class Commands:
AddHandler AcApp.DocumentManager.DocumentActivated, AddressOf Me.DocumentManager_DocumentActivated
and then
Private Sub DocumentManager_DocumentActivated(ByVal sender As Object, ByVal e As DocumentCollectionEventArgs)
m_Container1.txtADwg.Text = e.Document.Name
End Sub
That seems to work if I in Civil 3D 2015 opens up a couple of tabs before I execute my code, but if I opens up a new tab while my tool palette is up and running, Civil 3D stops responding and after some time "Fatal Error".
Am I missing something?