BYTEINSIGHT
GAPVelocity AI Studio helps you move from outdated tech stacks to the latest desktop, web, and cloud platforms—smarter, faster, and with less risk.
Choose a platform to see migration options:
GAPVelocity AI helps you move from outdated tech stacks to the latest desktop, web, and cloud platforms—smarter, faster, and with less risk.
Choose a platform to see migration options:
Our comprehensive approach to application modernization, from assessment to production deployment.
Transformation Services
Not Sure Where to Start?
See Free COM Object in VBUC Upgrade Options
Visual Basic 6 will automatically release COM objects when they are not referenced any more.
.NET automatically handles managed resources but does not release all resources immediately. This difference can cause unexpected behaviors. For example, ADO Connections might remain open longer than in VB6.
This optional feature will generate explicit code to achieve the same behavior.
Private Sub Command2_Click()
Set conn = CreateObject("ADODB.Connection")
conn.Open "northwind.mdb"
Set rs = CreateObject("ADODB.recordset")
rs.Open "Customers", conn
End Sub
private void Command2_Click( Object eventSender, EventArgs eventArgs)
{
ADODB.Connection conn = null;
ADODB.Recordset rs = null;
try
{
conn = new ADODB.Connection();
conn.Open("northwind.mdb", "", "", -1);
rs = new ADODB.Recordset();
rs.Open("Customers", conn, ADODB.CursorTypeEnum.adOpenUnspecified,
ADODB.LockTypeEnum.adLockUnspecified, -1);
}
finally
MemoryHelper.ReleaseAndCleanObject(rs);
rs = null;
MemoryHelper.ReleaseAndCleanObject(conn);
conn = null;
}
}