'进口'声明必须在任何声明之前

时间:2016-05-06 19:42:53

标签: vb.net import declaration

    module module1
    imports System.Collections.Generic
    imports System.Io
        sub main()



            dim subject as string
            dim topic(5) as string
            dim question(5) as string
            dim foundfile as List
            dim directory as string

            console.writeline("enter the subject your revising")
            subject=console.readline()

            directory="C:\Users\Zak\Documents\revisionhog\subjects\physics\imaging"

            For each file as String In IO.directory.Getfiles(directory, "*.pdf", IO.SearchOption.AllDirectories)
                foundfile.add(file)

            Next


            for x = 0 to 5
                console.writeline(foundFile)
            next

        end sub
end module

在搜索到字符串列表后添加我找到的文件。 我以为我在声明之前放了导入??? 帮助???

1 个答案:

答案 0 :(得分:0)

imports System.Collections.Generic
imports System.Io

module module1
        sub main()



        dim subject as string
        dim topic(5) as string
        dim question(5) as string
        dim foundfile as List
        dim directory as string

        console.writeline("enter the subject your revising")
        subject=console.readline()

        directory="C:\Users\Zak\Documents\revisionhog\subjects\physics\imaging"

        For each file as String In IO.directory.Getfiles(directory, "*.pdf", IO.SearchOption.AllDirectories)
            foundfile.add(file)

        Next


        for x = 0 to 5
            console.writeline(foundFile)
        next

    end sub
end module

首先进口,就像你提到的那样。这解决了import语句的问题,但您的问题有点不清楚。如果您有其他问题,请清楚说明。