I have this code in c#
void Backup()
{
string constr = "server=localhost;user=root;pwd=qwerty;database=test;";
string file = "C:\\MyDumpFile.sql";
MySqlBackup mb = new MySqlBackup(constr);
mb.ExportInfo.FileName = file;
mb.ExportProgressChanged += new MySqlBackup.exportProgressChange(mb_ExportProgressChanged);
mb.ExportCompleted += new MySqlBackup.exportComplete(mb_ExportCompleted);
timerRead.Start();
mb.Export();
}
when converted to VBNet
Private Sub Backup()
Dim constr As String = "server=localhost;user=root;pwd=qwerty;database=test;"
Dim file As String = "C:\MyDumpFile.sql"
Dim mb As New MySqlBackup(constr)
mb.ExportInfo.FileName = file
mb.ExportProgressChanged = mb.ExportProgressChanged + New MySqlBackup.exportProgressChange(mb_ExportProgressChanged)
mb.ExportCompleted = mb.ExportCompleted + New MySqlBackup.exportComplete(mb_ExportCompleted)
timerRead.Start()
mb.Export()
End Sub
I always get this error
‘exportProgressChange’ is a type in
‘MySql.Data.MySqlClient.MySqlBackup’ and cannot be used as an
expression.
What am I missing here?
Should work, cause in VB .net you cant use += for subcribing to an event, you have to use
AddHandlerandRemoveHandler.Edit: Tried it, so it compiled fine.