以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]内部函数中如何做到跳出程序,且不用返回值。  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=41213)

--  作者:loongtai
--  发布时间:2013/10/14 11:15:00
--  [求助]内部函数中如何做到跳出程序,且不用返回值。
如题,自定义一个函数,函数内部进行了一个判断 :如果条件1成立 ,则不需往下执行,直接跳出这个函数。
if 条件1=true then
return 
end if
显示错误:return 后必须返回值。
请问,有没有什么办法可以不用返回值,也能跳出程序。

--  作者:狐狸爸爸
--  发布时间:2013/10/14 11:18:00
--  
return ""
--  作者:jspta
--  发布时间:2013/10/14 11:26:00
--  
return nothing
--  作者:黄训良
--  发布时间:2014/11/4 19:45:00
--  
以下是引用狐狸爸爸在2013-10-14 11:18:00的发言:
return ""

 

Foxtable出现13秒的无响应状态


--  作者:有点甜
--  发布时间:2014/11/4 19:46:00
--  
 呃,要结合你对应的代码才知道什么问题。
--  作者:黄训良
--  发布时间:2014/11/4 20:00:00
--  

Dim str As DataRow = DataTables("类型").DataRows(0)  \'在这个表设置ftp连接信息
Dim ftp As new ftpclient
ftp.host= str("IP")
ftp.Port= str("Port")
ftp.Account = str("Account")
ftp.password = str("Password")
If ftp.DirExists(_TSG)

  

Else
    ftp.MakeDir(_TSG)
End If
ftp.RootDir =  _TSG

Dim ds As new List(of String)
Dim ds1 As new List(of String)
Dim ds2 As new List(of String)
ds.Clear
ds1.Clear
ds2.Clear
ds = ftp.GetDirList()

If ds.Count = 0

    Return ""

End If
If DataTables.Contains(_TSGMC) = False
    Dim dtb As New DataTableBuilder(_TSGMC)
    dtb.AddDef("系目", Gettype(String), 100)
    dtb.AddDef("类目", Gettype(String), 100)
    dtb.Build()
    \'MainTable= Tables(_TSGMC)
    Dim dr As Row
    Dim ss As String
    For i As Integer = 0 To ds.count -1
        ds1.Clear
        ds1.AddRange(ftp.GetDirList(ftp.RootDir & ds(i)))
        For Each st As String In ds1
            If ds2.Contains(ftp.RootDir  & ds(i) & "/" & st) = False
                ds2.add(ftp.RootDir  & ds(i) & "/" & st)
            End If
        Next
    Next
    If ds2.Count > Tables(_TSGMC).Rows.Count
        Tables(_TSGMC).AddNew(ds2.Count - Tables(_TSGMC).Rows.Count)
    End If
    For i As Integer = 0 To ds2.count -1
        dr = Tables(_TSGMC).Rows(i)
        ss = ds2(i)
        ss = ss.Replace("/","\\")
        dr("系目")  = ss.SubString(1).SubString(ss.SubString(1).IndexOf("\\")+1)                        \'ss += ds2(i) & ","
    Next
    Dim tv As WinForm.TreeView = Forms(_TSGCC).Controls("TreeView1")
    tv.CreateTree(_TSGMC,"系目")  \'
    tv.Nodes.Insert(_TSGMC,0)
    tv.Nodes(_TSGMC).Ic
Else
    Dim tv As WinForm.TreeView = Forms(_TSGCC).Controls("TreeView1")
    tv.CreateTree(_TSGMC,"系目")  \'
    tv.Nodes.Insert(_TSGMC,0)
    tv.Nodes(_TSGMC).Ic
End If

 

[此贴子已经被作者于2014-11-4 20:00:06编辑过]

--  作者:有点甜
--  发布时间:2014/11/4 20:03:00
--  

 加入msgbox,看哪里耗时