Hello I have an interesting bit of code which I am trying to fix but the error im getting is from a C# to VB.net conversion.
Error 1 'Public Event CurrentPath(hive As String, path As String)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event. C:\Users\Admin\Desktop\Registry Cleaner VB.NET\Form1.vb 287 9 VTRegScan
the code in question is:
_RegScan.CurrentPath += New cRegScan.CurrentPathDelegate(AddressOf RegScan_CurrentPath)
in the code _RegScan is :
Private _RegScan As cRegScan
currentpath is :
Public Event CurrentPath As CurrentPathDelegate
which leads to currentpathdelegate which is :
Public Delegate Sub CurrentPathDelegate(ByVal hive As String, ByVal path As String)
The last section of this code that i can give information about is RegScan_CurrentPath which is a private sub :
Private Sub RegScan_CurrentPath(ByVal hive As String, ByVal path As String)
_sHive = hive
_sPath = path
End Sub
within the private sub hive and path are strings and _sHive , _sPath = ""
For this question how might I correct this problem to raise the event?
thank you in advance!!
The code in C# is like so....
private void InitFields()
{
_RegScan = new cRegScan();
_RegScan.CurrentPath += new cRegScan.CurrentPathDelegate(RegScan_CurrentPath);
_RegScan.KeyCount += new cRegScan.KeyCountDelegate(RegScan_KeyCount);
_RegScan.LabelChange += new cRegScan.LabelChangeDelegate(RegScan_LabelChange);
_RegScan.MatchItem += new cRegScan.MatchItemDelegate(RegScan_MatchItem);
_RegScan.ProcessChange += new cRegScan.ProcessChangeDelegate(RegScan_ProcessChange);
_RegScan.ProcessCompleted += new cRegScan.ProcessCompletedEventHandler(RegScan_ProcessCompleted);
_RegScan.ScanComplete += new cRegScan.ScanCompleteDelegate(RegScan_ScanComplete);
_RegScan.SubScanComplete += new cRegScan.SubScanCompleteDelegate(RegScan_SubScanComplete);
_RegScan.ScanCount += new cRegScan.ScanCountDelegate(RegScan_ScanCount);
_RegScan.StatusChange += new cRegScan.StatusChangeDelegate(RegScan_StatusChange);
}
public event CurrentPathDelegate CurrentPath;
private void RegScan_CurrentPath(string hive, string path)
{
_sHive = hive;
_sPath = path;
}
#region Delegates
public delegate void LabelChangeDelegate(string phase, string label);
public delegate void CurrentPathDelegate(string hive, string path);
public delegate void KeyCountDelegate();
public delegate void MatchItemDelegate(cLightning.ROOT_KEY root, string subkey, string value, string data, RESULT_TYPE id);
public delegate void StatusChangeDelegate(string label);
public delegate void ProcessChangeDelegate();
public delegate void ScanCountDelegate(int count);
public delegate void ScanCompleteDelegate();
public delegate void SubScanCompleteDelegate(string id);
#endregion
#region Events
[Description("Status update")]
public event LabelChangeDelegate LabelChange;
[Description("Current processing path")]
public event CurrentPathDelegate CurrentPath;
[Description("Key processed count")]
public event KeyCountDelegate KeyCount;
[Description("Match item was found")]
public event MatchItemDelegate MatchItem;
[Description("Processing status has changed")]
public event StatusChangeDelegate StatusChange;
[Description("Processing shifted to new task")]
public event ProcessChangeDelegate ProcessChange;
[Description("Task counter")]
public event ScanCountDelegate ScanCount;
[Description("Scan Completed")]
public event ScanCompleteDelegate ScanComplete;
[Description("Scan Completed")]
public event SubScanCompleteDelegate SubScanComplete;
#endregion
I hope I have provided enough for a solution thank you..