关闭另一个窗体时,在辅助窗体上重新查询列表框

时间:2019-05-31 14:32:17

标签: forms ms-access

我有两种形式,using System; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; namespace Crawler { public sealed partial class DungeonRoom : UserControl { public static readonly DependencyProperty HasWestDoorProperty = DependencyProperty.Register("HasWestDoor", typeof(Boolean), typeof(DungeonRoom), new PropertyMetadata(false)); public static readonly DependencyProperty HasNorthDoorProperty = DependencyProperty.Register("HasNorthDoor", typeof(Boolean), typeof(DungeonRoom), new PropertyMetadata(false)); public static readonly DependencyProperty HasEastDoorProperty = DependencyProperty.Register("HasEastDoor", typeof(Boolean), typeof(DungeonRoom), new PropertyMetadata(false)); public static readonly DependencyProperty HasSouthDoorProperty = DependencyProperty.Register("HasSouthDoor", typeof(Boolean), typeof(DungeonRoom), new PropertyMetadata(false)); public static readonly DependencyProperty TypeProperty = DependencyProperty.Register("Type", typeof(RoomType), typeof(DungeonRoom), new PropertyMetadata(0)); public bool HasWestDoor { get { return (bool)GetValue(HasWestDoorProperty); } set { SetValue(HasWestDoorProperty, value); } } public bool HasNorthDoor { get { return (bool)GetValue(HasNorthDoorProperty); } set { SetValue(HasNorthDoorProperty, value); } } public bool HasEastDoor { get { return (bool)GetValue(HasEastDoorProperty); } set { SetValue(HasEastDoorProperty, value); } } public bool HasSouthDoor { get { return (bool)GetValue(HasSouthDoorProperty); } set { SetValue(HasSouthDoorProperty, value); } } public RoomType Type { get { return (RoomType)GetValue(TypeProperty); } set { SetValue(TypeProperty, value); } } public DungeonRoom() { this.InitializeComponent(); } } } frmOwnership。在frmContactDetails上,您可以单击一个按钮以打开frmOwnership到特定记录。

我遇到的问题frmContactDetails是从几个不同的来源打开的,并且没有指定(也不能真正?)关闭表单时要打开的表单。 frmContactDetails无法从frmOwnership打开,这意味着当您在“联系人详细信息”中编辑记录时,“所有权”表单保持打开状态。但是,我希望在frmContactDetails关闭时刷新lstItem上的控件(frmOwnership)。我试图向Got_Focus过程添加一个重新查询调用(frmContactDetails),但是它没有刷新。

谢谢!

1 个答案:

答案 0 :(得分:1)

最简单的方法是用frmContactDetails打开acDialog(作为打开它的其他任何形式的弹出窗口)。然后,无论用什么VBA代码在原始表单上打开它,都只有在frmContactDetails关闭后才能继续,您可以在此处刷新。