以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  全局代码中出现这样的错误  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=85401)

--  作者:rjh4078
--  发布时间:2016/5/25 9:37:00
--  全局代码中出现这样的错误

---------------------------
错误
---------------------------
编译错误:语句不能出现在方法体外。

 

错误代码:For Each f As String In io.Directory.GetFiles(ProjectPath & "images\\icons\\")
---------------------------
确定  
---------------------------
For Each f As String In io.Directory.GetFiles(ProjectPath & "images\\icons\\")
Dim ifo As New FileInfo(f)
Public Ifo.Extension.Replace(".","") As Image=GetImage(f)
Next


--  作者:大红袍
--  发布时间:2016/5/25 9:39:00
--  

全局代码那里,只能定义变量和方法。

 

代码要写在sub或function里面。