以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [讨论]窗口afterload代码报错 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=125752) |
-- 作者:81538475 -- 发布时间:2018/10/6 0:49:00 -- [讨论]窗口afterload代码报错 为何下面的代码在窗口的afterload 里面报错。但是单独窗口测试的时候却没问题呢。 --------------------------- 错误 --------------------------- 编译错误:Sub 或 Set 中的“Return”语句不能返回值。 错误代码:Return i --------------------------- 确定 --------------------------- Dim Names As New List(Of String) \'111 For i As Integer = 0 To Tables("进度表").cols.Count \'1 11 names.Add(i) If Tables("进度表").cols(i).name = “任务” Then \'111 Return i End If Next msgbox(“names.COUNT”) |
-- 作者:有点甜 -- 发布时间:2018/10/6 11:10:00 -- Dim Names As New List(Of String) \'111 For i As Integer = 0 To Tables("进度表").cols.Count-1 \'1 11 names.Add(i) If Tables("进度表").cols(i).name = "任务" Then \'111 Return End If Next msgbox(names.COUNT) |
-- 作者:81538475 -- 发布时间:2018/10/6 12:30:00 -- 那我只是想结束for 语句的循环如何写呢。return好像不能实现。 msgbox(names.count) 不执行了。 我这段代码是这样的。麻烦看看哪里错了 Dim Builder As New ADOXBuilder("渲奇表格数据") Builder.Open() \'打开ADOXBuilder With Builder.Tables("进度表") \'Dim D As Date = Date.Today Dim SD As Date = Date.Today.AddDays(-8).AddMonths(-1) Dim ED As Date = Date.Today.adddays(1).AddMonths(1) Dim nm As String = "sp" & SD.Year & "年" & SD.Month & "月_" & SD.Day Dim nm2 As String = "sp" & ED.Year & "年" & ED.Month & "月_" & ED.Day \'sd = sd.Adddays(1) Dim Names As New List(Of String) \'111 For i As Integer = 0 To Tables("进度表").cols.Count \'1 11 names.Add(i) If Tables("进度表").cols(i).name = nm Then \'111 Return End If Next msgbox(names.count) For i2 As Integer = 0 To names.count If Tables("进度表").cols.Contains(Tables("进度表").cols(i2).name)=True Then .DeleteColumn(Tables("进度表").cols(i2).name) msgbox(Tables("进度表").cols(i2).name) End If Next End With [此贴子已经被作者于2018/10/6 12:33:38编辑过]
|
-- 作者:有点甜 -- 发布时间:2018/10/6 14:35:00 -- 看看这里 exit for
http://www.foxtable.com/webhelp/scr/0225.htm
|