Hi guys, I'm new to this forum and I am just starting out in VB.net and have come across a problem and was wondering if you could help me.
I am trying to make a little app that will scan a file for its file size and report it back in a msgbox, but also will check if its over a certain size. If it is over a certain size it will copy it to a different folder.
Now the first part works fine, but I cannot get it to check if a file is over a certain size. This is the code I am using:
The problem I am having is in the IF statement, where the ">" is, its coming up with an error saying "Expression expected"?
I would be grateful for any help.
I am trying to make a little app that will scan a file for its file size and report it back in a msgbox, but also will check if its over a certain size. If it is over a certain size it will copy it to a different folder.
Now the first part works fine, but I cannot get it to check if a file is over a certain size. This is the code I am using:
Code:
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Fileinf As IO.FileInfo
Fileinf = My.Computer.FileSystem.GetFileInfo("C:\test\test.txt")
MsgBox(Fileinf.Length)
If My.Computer.FileSystem.GetFileInfo("C:\test\test.txt") is > 10 Then
FileCopy("C:\test\test.txt", "C:\test\test2\test.txt")
End If
End Sub
End Class
I would be grateful for any help.