How to Trap Active Form Name

Joined
Feb 21, 2005
Messages
21
Programming Experience
3-5
I m a beginner of vb.net How Can I Trap the Active Form Name in MDIParent Form ...I Want to trap Active Form Name and want to call the activeforms 's function from menu of MDI Parent .........................
 
this is a good starting point to what you're looking to do:
VB.NET:
     ‘Determine if form already exists 
  Dim frmTest As Form 
  Dim blnFound As Boolean = False 
   
  ‘Does form already exist? 
  For Each frmTest In Me.MdiChildren 
     With frmTest 
  	  If .Name = “frmForm” Then 
  		 .Activate()   ‘Activate previous instance 
  		 blnFound = True 
  	  End If 
     End With 
  Next 
  If blnFound = False Then 
     Dim frmForm As New frmForm 
     With frmForm 
  	  .MdiParent = Me 
  	  .Show() 
     End With 
  End If[font=&quot] [/font]

basically what this does is looks through all of the child forms looking for a specific form (you can add a check for something entered in the tag property too) anywho if the form is found then it's activated (given focus) if not, then one is created
 
thanx

thanx for giving me solution from this solution i can trap my form but if on run time i detect my form name and want to call its function then i m unable to do this .......


my scenerio is like this

i ve a common toolbar on my MDI parent for new , save ,open ,cancel ,print ,close

now on run time i want to detect my active child form name and want to call its function means late binding concept , can i do it in vb6 i used to do it
'' call activeform.fnnew()

here in .net if i do like this activeformname.fnnew() then it doesnt support it says function not found plz give me the solution if u can i ll be very thankful to u .

prashant
 
to open a new form:
VB.NET:
Dim frmForm As New frmForm 
     With frmForm 
  	  .MdiParent = Me 
  	  .Show() 
     End With
 
Back
Top