Foxtable(狐表)用户栏目专家坐堂 → 选择框里面的<, > ,= ,<=, >=,值如何体现在代码中呢?


  共有2739人关注过本帖树形打印复制链接

主题:选择框里面的<, > ,= ,<=, >=,值如何体现在代码中呢?

帅哥哟,离线,有人找我吗?
cnsjroom
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
选择框里面的 ,= ,=,值如何体现在代码中呢?  发帖心情 Post By:2021/6/19 16:22:00 [只看该作者]

选择框c1里面的<, > ,= ,<=, >=,值如何体现在代码中呢?
Dim c1 As WinForm.ComboBox = e.Form.Controls("ComboBox2")
    Dim tx2 As WinForm.TextBox = e.Form.Controls("TextBox2")
    If tel1 < tx2.Text Then   选择框c1里面的<, > ,= ,<=, >=,值如何体现在这里的代码中呢?
        If FileSys.FileExists(file) Then '如果指定的文件存在
            FileSys.CopyFile(file,"d:\数据\" & FileSys.Getname(File),True) '则彻底删除之
        End If
    End If

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106067 积分:539428 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/6/19 16:30:00 [只看该作者]

那要使用动态函数了:http://www.foxtable.com/webhelp/topics/1487.htm



 回到顶部
帅哥哟,离线,有人找我吗?
cnsjroom
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
回复:(有点蓝)那要使用动态函数了:http://www.fox...  发帖心情 Post By:2021/6/19 18:55:00 [只看该作者]

Dim Code As String
Code = "Dim c1 As WinForm.ComboBox=e.Form.Controls("ComboBox2")" & vbcrlf
Code = Code & "Dim tx2 As WinForm.TextBox = e.Form.Controls("TextBox2")" & vbcrlf
Code = Code & "If tel1"& tx2.text &"tx2.Text Then"" & vbcrlf
Code = Code & "If FileSys.FileExists(file) Then" & vbcrlf
Code = Code & "FileSys.CopyFile(file,"d:\数据\" & FileSys.Getname(File),True)" & vbcrlf
Code = Code & "End If" & vbcrlf
Code = Code & "End If" & vbcrlf
Functions.Add("Sum",Code)
Functions.Complie()

这样每  不能成功保存  麻烦老师帮忙看看是不是哪里没有写对呢

提示字符常量必须正好包含一个字符
[此贴子已经被作者于2021/6/19 19:17:19编辑过]

 回到顶部
帅哥,在线噢!
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106067 积分:539428 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/6/20 19:56:00 [只看该作者]

参考:http://www.foxtable.com/webhelp/topics/0211.htm

Code = "Dim c1 As WinForm.ComboBox=e.Form.Controls(""ComboBox2"")" & vbcrlf

 回到顶部
帅哥哟,离线,有人找我吗?
cnsjroom
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
回复:(有点蓝)参考:http://www.foxtable.com/webh...  发帖心情 Post By:2021/6/20 20:40:00 [只看该作者]

红色部分代码提示未定义  老师有没有办法呢?

c2.value  有  <    >    <=    >=   =   <> 等
Dim Code As String
Code = "Dim c2 As WinForm.ComboBox=e.Form.Controls(""ComboBox2"")" & vbcrlf
Code = Code & "Dim tx2 As WinForm.TextBox = e.Form.Controls(""TextBox2"")" & vbcrlf
Code = Code & "If tel1" & c2.value & tx2.Text & "Then"" & vbcrlf
Code = Code & "If FileSys.FileExists(file) Then" & vbcrlf
Code = Code & "FileSys.CopyFile(file,""d:\数据\"" & FileSys.Getname(File),True)" & vbcrlf
Code = Code & "End If" & vbcrlf
Code = Code & "End If" & vbcrlf
output.show(Code)

图片点击可在新窗口打开查看此主题相关图片如下:123.png
图片点击可在新窗口打开查看

[此贴子已经被作者于2021/6/20 20:46:52编辑过]

 回到顶部
帅哥,在线噢!
有点蓝
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106067 积分:539428 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/6/20 21:14:00 [只看该作者]

要按自定义函数的标准用法定义代码。先建一个函数,把代码放到函数里,测试通过后再用到动态函数里

dim e = args(0)
dim tel1 as string = args(1)
Dim c1 As WinForm.ComboBox = e.Form.Controls("ComboBox2")
……


调用此函数:

Functions.Execute("Sum",e,tel1)


 回到顶部
帅哥哟,离线,有人找我吗?
cnsjroom
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
回复:(有点蓝)要按自定义函数的标准用法定义代码。...  发帖心情 Post By:2021/6/20 23:57:00 [只看该作者]

还是不大明白怎么写哦  劳烦老师辛苦下  帮忙看看怎么写  谢谢 我也学习一下

 回到顶部
帅哥,在线噢!
有点蓝
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106067 积分:539428 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/6/21 8:29:00 [只看该作者]

先学会使用自定义函数:http://www.foxtable.com/webhelp/topics/1486.htm

 回到顶部
帅哥哟,离线,有人找我吗?
y2287958
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐神 帖子:4627 积分:33767 威望:0 精华:0 注册:2008/8/31 22:44:00
  发帖心情 Post By:2021/6/21 14:38:00 [只看该作者]

如果还不懂自定义函数,可根据“<, > ,= ,<=, >=”这几种情况直接写代码即可。

 回到顶部
帅哥哟,离线,有人找我吗?
cnsjroom
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
回复:(有点蓝)先学会使用自定义函数:http://www.f...  发帖心情 Post By:2021/6/24 8:35:00 [只看该作者]

.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2020.5.29.8
错误所在事件:自定义函数,sx
详细错误信息:
调用的目标发生了异常。
从字符串“1991-01-16=1990”到类型“Boolean”的转换无效。
输入字符串的格式不正确。

Dim t3 As WinForm.TextBox = e.Form.Controls("单元格行")
Dim t4 As WinForm.TextBox = e.Form.Controls("单元格列")
Dim t5 As WinForm.TextBox = e.Form.Controls("文件目录")
Dim t6 As WinForm.TextBox = e.Form.Controls("单元格新值")
Dim t7 As WinForm.TextBox = e.Form.Controls("运行状态")
Dim js As WinForm.Label = e.Form.Controls("计数")
Dim mb As WinForm.TextBox = e.Form.Controls("目标目录")
Dim cm As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim mulu As WinForm.RadioButton = e.Form.Controls("筛选后打开目标目录")
For Each File As String In FileSys.GetFiles(t5.value)
    Dim ifo As new FileInfo(File)
    If ifo.Name.Contains("~$") Then
    Else
        If ifo.Extension.Contains("xlsx") Then
            Dim App As New MSExcel.Application
            Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(file)
            Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
            Dim Rg As MSExcel.Range = Ws.Cells(cint(t3.value),cint(t4.value)).offset(-1)
            Dim abcd As String=Rg.Value
            Functions.Execute("sx",t5.text,abcd,cm.text,t6.text,mb.text)
        End If
    End If
Next

sx内部函数代码:
'''
Dim e = args(0)
Dim tel1 As String = args(1)
Dim tel2 As String = args(2)
Dim tel3 As String = args(3)
Dim tel4 As String = args(4)
If  tel1 & tel2 & tel3 Then
    If FileSys.FileExists(e) Then
        MessageBox.Show("1")
        FileSys.CopyFile(e, tel4 & FileSys.Getname(e),True)
    End If
End If


 回到顶部
总数 11 1 2 下一页