.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> General >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Accessing Child Form Controls by Parent Form in MDI

Posted By:Hefin Dsouza       Posted Date: August 13, 2009    Points: 25    Category: General    URL: http://www.dotnetspark.com  
 

This Sample Demonstrates How MDI Applications work.

The New MDI Child is Created Using.

Dim f2 As New Form2
i += 1
f2.Text = "Form " & i
f2.MdiParent = Me
f2.Show()

Closing Active Forms.

Me.ActiveMdiChild.Close()

Closing All Mdi Forms.

For Each f As Form In MdiChildren
f.Close()
Next

Accessing Child Conrols in Parent Form.

If ActiveMdiChild Is Nothing Then
Else
Dim txt As TextBox = CType(ActiveMdiChild, Form2).TextBox1 'This Code is used to Convert the ActiveMdiChild back ti Form2 Type
If ColorDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
txt.ForeColor = ColorDialog1.Color
End If
End If


Replacing Some Words With ******

If ActiveMdiChild Is Nothing Then
Else
Dim txt As TextBox = CType(ActiveMdiChild, Form2).TextBox1
For Each word As String In ToolStripComboBox1.Items
txt.Text = txt.Text.Replace(word, "*****")
txt.Text = txt.Text.Replace(word.ToLower(), "*****")
txt.Text = txt.Text.Replace(word.ToUpper(), "*****")
Next
End If

This Method can be used to Filter Word's in A TextBox.

Download Sample Code.
================================================================================
Regards Hefin Dsouza
================================================================================
 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend