What is the Right$ conversion to .net

patster

New member
Joined
May 10, 2005
Messages
3
Programming Experience
Beginner
Here is my practice code:



Public
Class frmMain

Private Sub cmdView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdView.Click

Dim sExtension As String



Dim iReturnValue As VariantType



sExtension = UCase$(Right$(txtFile.Text, 3))



If Dir$(txtFile.Text) = "" Then



MsgBox(
"Sorry, I couldnt find that file!" & vbCrLf & "It may be hidden.", vbExclamation)

Exit Sub



ElseIf sExtension = "TXT" Then



iReturnValue = Shell(
"Notepad " & txtFile.Text, 1)

ElseIf sExtension = "BMP" Then



iReturnValue = Shell(
"PBrush " & txtFile.Text, 1)

End If



End Sub

End
Class

I get an error of

Error 1 Type character '$' does not match declared data type 'Integer'.
Error 2 'Public ReadOnly Property Right() As Integer' has no parameters and its return type cannot be indexed.

For Line...sExtension = UCase$(Right$(txtFile.Text, 3))
What exactly am I doing wrong?

Thanks

Patster

 
The Right you are using is the Control.Right() property, because your Form has a Right() property inherited from Control. You want to use Microsoft.VisualBasic.Right(). In the code editor, IntelliSense should tell you what function you are using as you type it, or you can put the cursor in the object/property/method name and press F1 to get help. The second error message was the tell-tale sign.
 
Back
Top