dim rsCust as recordset dim abc as string abc = rsCust!salesprice
The VB6 "bang" operator provides condensed syntax for indicating fields within a recordset. In VB.NET the "bang" syntax is no longer supported.
The answer to your question is different depending upon whether Option Strict is On or Off. By default it is Off and VB.NET will do implicit conversions between datatypes.
For Option Strict Off the short answer is:
abc = rsCust("salesprice").Value
For Option Strict On explicit type conversion is required and for string fields the ToString method of the value performs the conversion:
abc = rsCust("salesprice").Value.ToString
However, if you are not tied to the ADO recordset, I suggest spending the time to upgrade to ADO.NET where you can use Strongly Typed DataSets. The field names are verified by Visual Studios Intellisense and the new syntax is almost the same as the VB6 syntax:
abc = rowCust.saleprice
There are many good articles on using ADO.NET and Strongly Typed DataSets available in the Microsoft documentation.
This was first published in July 2004