×

Loading...
Ad by
  • 予人玫瑰,手有余香:加拿大新天地工作移民诚聘求职顾问&行业导师!
Ad by
  • 予人玫瑰,手有余香:加拿大新天地工作移民诚聘求职顾问&行业导师!

not sure what you want, but try this // btw, not good for your digestion asking questions before your dinner //

create 2 forms and 2 buttons on each
dump the following code in, see what
gonna happen.

'---form1---
Option Explicit
Public P_PARENT As Form
Private Sub Command1_Click()
Set Form2.P_PARENT = Me
Form2.Show
End Sub
Private Sub Command2_Click()
If Not P_PARENT Is Nothing Then
MsgBox P_PARENT.Name
Else
MsgBox "NO PARENT"
End If
End Sub


'---form2---
Option Explicit
Public P_PARENT As Form
Private Sub Command1_Click()
Set Form1.P_PARENT = Me
Form1.Show
End Sub
Private Sub Command2_Click()
If Not P_PARENT Is Nothing Then
MsgBox P_PARENT.Name
Else
MsgBox "NO PARENT"
End If
End Sub
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / 吃饭前,问个问题,VB的FORM有没有父子关系啊,就是我有一个FORM,我想知道是谁调用它的,谢谢
    • me.parent
      • 哦,这么简单,谢谢,我找了FORM的属性没有PARENT:)
        • there is no parent attribute about me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
          • 去升级用VB.NET版。
            • but I only have vb 6.0 now : (
    • 上班忘了带你的email。:-)
      解决了,昨天后来做demo发现可能不是控件的bug,事件触发时有些weird的事情用microsoft的控件也发生了,所以我决定直接写到数据源。
      • 搞定了就好
    • nobody knows how to do it under vb6.0?
      • hehe, hou zhe lian pi zai ding yi ci : )
      • not sure what you want, but try this // btw, not good for your digestion asking questions before your dinner //
        create 2 forms and 2 buttons on each
        dump the following code in, see what
        gonna happen.

        '---form1---
        Option Explicit
        Public P_PARENT As Form
        Private Sub Command1_Click()
        Set Form2.P_PARENT = Me
        Form2.Show
        End Sub
        Private Sub Command2_Click()
        If Not P_PARENT Is Nothing Then
        MsgBox P_PARENT.Name
        Else
        MsgBox "NO PARENT"
        End If
        End Sub


        '---form2---
        Option Explicit
        Public P_PARENT As Form
        Private Sub Command1_Click()
        Set Form1.P_PARENT = Me
        Form1.Show
        End Sub
        Private Sub Command2_Click()
        If Not P_PARENT Is Nothing Then
        MsgBox P_PARENT.Name
        Else
        MsgBox "NO PARENT"
        End If
        End Sub
        • 试用了一下可以达到我的要求,谢谢:)
    • Try Win32 API, you may get you want.
      • 能不能具体一点,我是初学者,自己弄着玩
        • I have impression that VB can call Windows API. With those APIs, you can get your current Window handle, then stretch to parent window.