Visual Basic Equivalence to C #

0

I am trying to pass and pass a solution of visual basic to c# , I have had problems in learning the syntax, right now I am stopped with these lines:

Conversion # 1

Dim aoIniFile As axdLibrary.IniFileName = New IniFileName(acdataDirectory & "\cnxapp.ini")

Conversion # 2

Private WithEvents aoCnx As New SqlClient.SqlConnection(My.Settings.mCnxSrv.ToString)

Thanks in advance.

    
asked by alfredo.avmb 21.06.2017 в 01:51
source

2 answers

1
axdLibrary.IniFileName aoIniFile  = new axdLibrary.IniFileName(acdataDirectory + "\cnxapp.ini");

1.- " WithEvents " does not exist as such in C #. Its "equivalent" is, rather, a similar / replication approach. See code below.

2.- The statement " My.Settings.mCnxSrv.ToString " refers to an object and its particular call in VB. Its equivalent would be the object 'Settings'.

System.SqlClient.SqlConnection conn = new System.SqlClient.SqlConnection(Settings.mCnxSrv.ToString());
conn.StateChange += new EventHandler(Metodo_CambioDeEstado);

private void Metodo_CambioDeEstado (object sender, EventArgs e)
{

}

MSDN articles:

answered by 21.06.2017 / 02:19
source
0

1

axdLibrary.IniFileName aoIniFile = new IniFileName(acdataDirectory + "\cnxapp.ini");

2

private SqlClient.SqlConnection aoCnx = new SqlClient.SqlConnection(My.Settings.mCnxSrv.ToString);
  

You can use an online converter such as: link

    
answered by 21.06.2017 в 02:17