以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]调用内部函数字典 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=179936) |
-- 作者:2425004926 -- 发布时间:2022/9/19 14:36:00 -- [求助]调用内部函数字典 自定义函数,名称ButtonZd Dim zd As New Dictionary(Of String, String) zd.Add("AddNew", "增加行")zd.Add("MoveUpRow", "上移行") zd.Add("MoveDownRow", "下移行") zd.Add("Save", "保存") ...... Return zd \'--------------------------------------------------这样的用法可以 Dim zd As New Dictionary(Of String, String) zd.Add("AddNew", "增加行") zd.Add("MoveUpRow", "上移行") zd.Add("MoveDownRow", "下移行") zd.Add("Save", "保存") ...... Dim sz1() As String = zd.Keys.ToArray() \'键转化为数组 Dim sz2() As String = zd.Values.ToArray() \'值转化为数组 ’--------------------------------------------------调用字典,为什么会出错呢 Dim sz1() As String = Functions.Execute("ButtonZd").Keys.ToArray() Dim sz2() As String = Functions.Execute("ButtonZd").Values.ToArray()
|
-- 作者:有点蓝 -- 发布时间:2022/9/19 14:43:00 -- 类型转换问题,定义个变量即可 Dim zd As Dictionary(Of String, String) = Functions.Execute("ButtonZd") Dim sz1() As String = zd.Keys.ToArray() \'键转化为数组 Dim sz2() As String = zd.Values.ToArray() \'值转化为数组 |
-- 作者:2425004926 -- 发布时间:2022/9/19 14:50:00 -- 感谢!感谢!感谢老师! |