I am trying to convert "RW XML Files, Config Files, INI files, or the Registry", an old article by Alvaro Mendez, from C# to vb.net. I use a very good program named "InstantVB" for the conversion, but it stumbled on one item out of all the code. It has to do with converting the use of two events. I am not very experienced with using events in general, and don't know where to start in trying to fix this. Any help would be appreciated. I have included the relevant code from the original C# and the VB.net code from the Converter.
Any help would be very much appreciated.
RCTaubert
The C# code in question is as follows (I marked the two culprit lines at the end with an asterisk:
##############################################################
namespace AMS.Profile
{
public abstract class Profile : IProfile
{
private string m_name;
private bool m_readOnly;
public event ProfileChangingHandler Changing;
public event ProfileChangedHandler Changed;
protected Profile()
{
m_name = DefaultName;
}
protected Profile(string name)
{
m_name = name;
}
protected Profile(Profile profile)
{
m_name = profile.m_name;
m_readOnly = profile.m_readOnly;
* Changing = profile.Changing;
* Changed = profile.Changed;
}
##############################################################
It translates to VB.net as (again I use an asterisk):
##############################################################
Namespace AMS.Profile
''' <summary>
''' Abstract base class for all Profile classes in this namespace.
''' </summary>
''' <remarks>
''' This class contains fields and methods which are common for all
''' the derived Profile classes.
''' It fully implements most of the methods and properties of its
''' base interfaces so that derived classes don't have to. </remarks>
Public MustInherit Class Profile
Implements IProfile
' Fields
Private m_name As String
Private m_readOnly As Boolean
''' <summary>
''' Event used to notify that the profile is about to be changed.
''' </summary>
''' <seealso cref="Changed" />
Public Event Changing As ProfileChangingHandler Implements IProfile.Changing
''' <summary>
''' Event used to notify that the profile has been changed.
''' </summary>
''' <seealso cref="Changing" />
Public Event Changed As ProfileChangedHandler Implements IProfile.Changed
''' <summary>
''' Initializes a new instance of the Profile class by setting the
''' <see cref="Name" /> to <see cref="DefaultName" />. </summary>
Protected Sub New()
m_name = DefaultName
End Sub
''' <summary>
''' Initializes a new instance of the Profile class by setting the
''' <see cref="Name" /> to a value. </summary>
''' <param name="name">
''' The name to initialize the <see cref="Name" /> property with. </param>
Protected Sub New(ByVal name As String)
m_name = name
End Sub
''' <summary>
''' Initializes a new instance of the Profile class based on another
''' Profile object. </summary>
''' <param name="profile">
''' The Profile object whose properties and events are used to
''' initialize the object being constructed. </param>
Protected Sub New(ByVal profile As Profile)
m_name = profile.m_name
m_readOnly = profile.m_readOnly
* AddHandler Changing, profile.Changing
* AddHandler Changed, profile.Changed
End Sub
##############################################################
VB.net's complaint about the lines are as follows:
Can you possibly tell me how this should be handled in VB.net.
Thank you.