AdvancedHMI Software
General Category => Open Discussion => Topic started by: bachphi on December 27, 2019, 02:47:56 PM
-
How'd you translate these C# codes to VB? Thanks.
private static Settings _instance;
public static Settings Instance
{
get { return _instance ?? (_instance = new Settings()); }
}
Private Shared _instance As Settings
Public Shared ReadOnly Property Instance As Settings
Get
If (_instance Is Nothing) Then
_instance = New Settings
End If
Return _instance
End Get
End Property
-
Your 2nd code is a translated 1st code.
-
Your 2nd code is a translated 1st code.
Thank you for verifying that! I wasn't so sure.
-
Your translation is elegant unlike what online converters offer as a translation for that C# code.
-
This is one I keep forgetting:
//Add event handlers
txtSQLServerName.TextChanged += BuildConnectionString;
AddHandler txtSQLServerName.TextChanged, AddressOf BuildConnectionString
-
In C# application, any statement/ sub routines that put right after InitializeComponent() will get execute BEFORE form_move and form_load events.
in VB, select view code, select middle drop down Form , select right side drop down New.
Public Sub New()
' This call is required by the designer.
InitializeComponent()
DoEventFirst()
' Add any initialization after the InitializeComponent() call.
End Sub