跨表单调用子例程(非模块) [英] Calling Subroutines across Forms (non-module)

查看:79
本文介绍了跨表单调用子例程(非模块)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

真的,我已经找到了答案,但我必须在某处遗漏一些语法...


我有一个弹出式日历,可用于多种形式。每个表单都需要日历自动将所选日期输入到指定的文本框中(此部分已经很好地工作),然后在连续表单上更新过滤器以包含该日期范围。


现在,我有几个需要这个弹出日历的表单,所以我试着让它尽可能通用,以便它可以处理所有这些。我设置了一个模块,允许以下全局变量:


公共目标为TextBox

公共formName为表格


在日历表格中,我有以下内容:

Really, i''ve looked for the answer, but I must be missing some syntax somewhere...

I have a popup calendar which is to be used across several forms. Each form will need the calendar to automatically enter the selected date into the designated textbox (this part works beautifully already) and then update the filter on a continuous form to include that date range.

Now, I have several forms which will be in need of this popup calendar, so I''m trying to make it as general as possible so it can handle all of them. I set things up with a module, allowing for the following global variables:

Public target As TextBox
Public formName As Form

In the calendar form, I have the following:

展开 | 选择 | Wrap | 行号

推荐答案

isoquin。


这是一个可能的解决方案。当用户dblclicks文本框时,当它为空时,或者打开日历弹出窗口时,它将填充当前日期。
  • " frmCalendar" - 表示名为axcCalendar的日历控件的表单。放置。
  • 以下步骤放在公共模块中。
Hi, isoquin.

Here is one possible solution. When user dblclicks on a textbox it is being filled with current date when it is empty or otherwise calendar popup is opened .
  • "frmCalendar" - form where calendar control named "axcCalendar" is placed.
  • Procedure below is placed in public module.
展开 | 选择 | Wrap | 行号


I我觉得我解释得不够好。我已经完成了大部分工作。弹出我的日历,可以拍摄日期,将日期放在正确的位置。现在,在放置日期之后,我需要原始表单来运行子程序。


鉴于我将原始表单存储在全局模块变量中,怎么做在日期发布后,我会自动从该表单调用我需要的子表单吗?在此事件之后,只需记录选择就需要更多的东西。不幸的是,在日期放入文本框后似乎没有激活On事件的可能性。
I don''t quite think I explained well enough. I have most of that already. My calendar pops up, can take a date, places the date in the right place. Now, after the date is placed, I need the original form to run a subroutine.

Given the fact that I''m storing the originating form in a global module variable, how do I call the sub I need from that form automatically after the date is placed? There are more things needed past just record selection after this event. Unfortunately, none of the On Event possibilities seem to activate after the date is placed in the textbox.



我不太想我解释得很好。我已经完成了大部分工作。弹出我的日历,可以拍摄日期,将日期放在正确的位置。现在,在放置日期之后,我需要原始表单来运行子程序。


鉴于我将原始表单存储在全局模块变量中,怎么做在日期发布后,我会自动从该表单调用我需要的子表单吗?在此事件之后,只需记录选择就需要更多的东西。不幸的是,在将日期放入文本框后,似乎没有任何On Event可能性激活。
I don''t quite think I explained well enough. I have most of that already. My calendar pops up, can take a date, places the date in the right place. Now, after the date is placed, I need the original form to run a subroutine.

Given the fact that I''m storing the originating form in a global module variable, how do I call the sub I need from that form automatically after the date is placed? There are more things needed past just record selection after this event. Unfortunately, none of the On Event possibilities seem to activate after the date is placed in the textbox.



那里。


在我看来,最自然和最常用的方法是写类引发事件。

然后在类的表单模块对象中实例化并处理它的事件。


希望你有一些面向对象的东西节目。如果不是,请用这个相当简单的课程开始学习。


祝你好运。


P.S.我很乐意帮助您编码。

Hi, there.

The most natural and commom way to do it, to my mind, is to write Class that raises events.
Then to instantiate in form module object of the class and handle it''s events.

Hope you have some sence of object oriented programming. If no, start to learn it with this rather simple class.

Good luck.

P.S. I''ll be glad to help you with coding.


这篇关于跨表单调用子例程(非模块)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆