Hi
This works OK
Dim MyDb As String = "Freddy"
Try : If MyDb IsNot Nothing Then : MyDb = "Brian" : End If : Catch ex As Exception : End Try
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am upgrading VB.NET projects from VS2015 to VS2022. Many lines use the colon for multiple statements on a single line, like
Try : If MyDb IsNot Nothing Then MyDb.Dispose() Catch : End Try
This was, and should still be, acceptable per
Statements in Visual Basic | Microsoft Learn where it states, "You can have multiple statements on a single line separated by the colon (:) character."
Instead, I am getting errors like, "'Try' must end with a matching 'End Try'." I couldn't find any setting for this in Tools | Options. Am I missing something?
Hi
This works OK
Dim MyDb As String = "Freddy"
Try : If MyDb IsNot Nothing Then : MyDb = "Brian" : End If : Catch ex As Exception : End Try