乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 79|回复: 5

[编程交流] 当ca

[复制链接]

34

主题

105

帖子

91

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
224
发表于 2022-7-6 17:29:33 | 显示全部楼层 |阅读模式
当从一个子公司呼叫到另一个子公司时,你能保持字符串值吗?
 
干杯
 
Col。
回复

使用道具 举报

4

主题

940

帖子

961

银币

初来乍到

Rank: 1

铜币
12
发表于 2022-7-6 17:46:18 | 显示全部楼层
如果你不申报
e、 g.声明
  1. (defun test1 (/ strng1)
  2. (setq strng1 (getstring "Enter sumthin: "))
  3. )

未申报的
  1. (defun test2 ()
  2. (setq strng2 (getstring "Enter sumthin else"))
  3. )

如果您加载并运行这些函数!strng1将返回nil[对于其他sub不可用]!strng2将返回字符串[可用]
回复

使用道具 举报

0

主题

132

帖子

198

银币

限制会员

铜币
-21
发表于 2022-7-6 18:00:04 | 显示全部楼层
在VB中,您可以将其设置为模块级变量(即模块顶部的“Private varname as string”)或全局变量(即“Public varname as string”)。模块级可用于模块中的所有子模块/功能,全局可用于任何模块。这是一种方法,还有其他方法可以实现。
回复

使用道具 举报

24

主题

1265

帖子

1028

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
362
发表于 2022-7-6 18:11:02 | 显示全部楼层
当然,您仍然可以使用局部变量,只需将第一个函数的结果作为参数传递给第二个函数。
 
  1. ;;; function 1 just sets a string to the var [b]str[/b]
  2. (defun fun1 ( / str)
  3. (setq str "\nthis is a test string")
  4. str
  5. )
  6. ;;; function 2 expects an argument and prints it.
  7. (defun fun2 (arg)  
  8. (princ arg)
  9. )
  10. ;;; this code just calls function 2 with function 1 as an argument
  11. (fun2 (fun1))
  12. ;;; when you are done, [b]str[/b] is either
  13. ;;; nil or it's previous value before running
  14. ;;; any of this code.
回复

使用道具 举报

34

主题

105

帖子

91

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
224
发表于 2022-7-6 18:19:27 | 显示全部楼层
你好
 
我正在使用Vb,并尝试将以下内容放在通用/声明部分的模块顶部
 
  1. <p>Public MyAttTextStr As String</p><p>[/code[</p><p> </p><p>but looking in the local window it does not show the string at all?</p><p> </p><p>if i put it at the top of the module with the other Dims then it works for that module?</p><p> </p><p>cheers, </p><p> </p><p>col</p>
回复

使用道具 举报

34

主题

105

帖子

91

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
224
发表于 2022-7-6 18:35:25 | 显示全部楼层
对不起,实际上它确实有效!!
 
非常感谢!
 
col公司
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-4 16:26 , Processed in 0.347711 second(s), 64 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表