Emptying both forms textboxes with a single click in client-server environment

cloud

Newcomer
Joined
Aug 14, 2003
Messages
12
If I got a MDIparent with 2 MDIchild in it, with each form(MDIchild) has a 2 textbox (1 is send textbox and another is received textbox) and 2 buttons (1 is Send button and the other is Reset button), does anyone know the way that when I click on Reset button, the received textbox on both forms will be emptied. I'm going to implement in client-server environment. Now, I only manage to clear one form Received textbox but not the other. Any ideas anyone? :confused:
 
if i understood correctly your trying to clear the textbox on another form in the same project to do that u have the code
Visual Basic:
Public frm2 As New Form2()
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.AddOwnedForm(frm2)
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
me.textbox1.text=""
me.textbox2.text=""
frm2.textbox1.text=""
frm2.textbox2.text=""
end sub
hope this helps ALSO i dont know if the code is EXACTLY correct just shout if its not and i'll fix it
:p
 
Yes, starcraft.
U understand correctly. I think to put it in a better way of words, I wanna access the properties inside MDIchild1 from MDIchild2.
I tried out the codes u gave..
It seems when u type ".", VB.NET doesn't seems to show the property of the form which in this case is a textbox I'm looking for. So I'm still stuck at the clearing textbox part since after declaring the form from what u have suggested, typing in the word "frm2" no longer gives me error but still to no avail, doesn't apply to the property inside the form.
 
hmmm..... i'm no expert by all means :p but i thought i'd throw in my thoughts cause i was dealing with muilti forms at one point and that is what i ended up using but i also didn't use MDIchild. So we might need to get an expert in here like Mutant of Volt.
 
What you could do is to either create a class wth shared members that you will assign an instance of your mdi children or create public variables in your parent and assign the child instances to those variables and then access them from children using the MDIParent property.
If you want to use the class with shared members then make a new class and make it look like this:
Visual Basic:
Public Class SharedInstances 'you can call this whatever you want
Private Shared _childoneinstance As ChildOneForm 'private variable of the child  type
Private Shared _childtwoinstance As ChildTwoForm
'then have properties to modify those variables
Public Shared Property ChildOne As ChildOneForm 'property of the form's type
Get
       Return _childoneinstance
End Get
Set (Byval Value As ChildOneForm)
       _childoneinstance = Value
End Set
End Property
'and then for the second one
Public Shared Property ChildTwo As ChildTwoForm 'property of the form's type
Get
       Return _childtwoinstance
End Get
Set (Byval Value As ChildTwoForm)
       _childtwoinstance = Value
End Set
End Property
Then when you create those two children from your parent set those properties to the instances your created in your parent.
Visual Basic:
SharedInstances.ChildOne = variablewithinstance
SharedInstances.ChildTwo = variablewithinstance
Then you can access the shared class like this from any other form in that project:
Visual Basic:
SharedInstances.ChildOne.SomePropertyormethod()
 
Thanks for the codes and ideas, guys..
It's now working fine..
Thanks for the coding mutant..
 
Back
Top