473,850 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to read text from childMdi form textbox?

If I cycle through the MdiChildActivat e event of the
parent form I can read text in a textbox on the child
mdiform --

console.writeli ne(Me.ActiveMdi Child.Controls( 1).Text)

But if I have a sub in the Parent form and reference a
child mdi form like this:

Sub ReadText()
Dim frm As New Form2
console.writeli ne(frm.txt1.tex t)
End Sub

--I can't read the text in the textbox of the child form.
How could I read the text in a textbox of a child mdi form
from a sub in the parent form?

TIA
Adda
Nov 20 '05 #1
16 3917
Hi,

Dim frmChild As Form2

For Each frmChild In Me.MdiChildren

Debug.WriteLine (frmChild.TextB ox1.Text)

Next

Ken

---------------------

"Adda" <an*******@disc ussions.microso ft.com> wrote in message
news:19******** *************** ******@phx.gbl. ..
If I cycle through the MdiChildActivat e event of the
parent form I can read text in a textbox on the child
mdiform --

console.writeli ne(Me.ActiveMdi Child.Controls( 1).Text)

But if I have a sub in the Parent form and reference a
child mdi form like this:

Sub ReadText()
Dim frm As New Form2
console.writeli ne(frm.txt1.tex t)
End Sub

--I can't read the text in the textbox of the child form.
How could I read the text in a textbox of a child mdi form
from a sub in the parent form?

TIA
Adda

Nov 20 '05 #2
Hi,

Dim frmChild As Form2

For Each frmChild In Me.MdiChildren

Debug.WriteLine (frmChild.TextB ox1.Text)

Next

Ken

---------------------

"Adda" <an*******@disc ussions.microso ft.com> wrote in message
news:19******** *************** ******@phx.gbl. ..
If I cycle through the MdiChildActivat e event of the
parent form I can read text in a textbox on the child
mdiform --

console.writeli ne(Me.ActiveMdi Child.Controls( 1).Text)

But if I have a sub in the Parent form and reference a
child mdi form like this:

Sub ReadText()
Dim frm As New Form2
console.writeli ne(frm.txt1.tex t)
End Sub

--I can't read the text in the textbox of the child form.
How could I read the text in a textbox of a child mdi form
from a sub in the parent form?

TIA
Adda

Nov 20 '05 #3
Thank you. I also discovered that if I declare the
childform at the Form level of the Parent form as shared I
can also read the text in the textbox.

While I am at it, what I am actually trying to do is to
refresh a datagrid on the parent form with data that I
enter in the child form. I pass a datarow object to the
child and populate it and then update the dataset with a
dataAdapter (using a button on the childform or an Add
menu selection from the parent form). This works fine but
the new row doesn't show up in the datagrid on the parent
form until after I do a dataset.clear, dataAdatapter.F ill
(dataset, "tbl1") on the parent form from a menu event o
the Parent. Could you suggest a way that I could make the
new row show up in the datagrid when in the same event
that I update the dataset with the data from the childform?

Thank you again for your reply.
Adda

-----Original Message-----
Hi,

Dim frmChild As Form2

For Each frmChild In Me.MdiChildren

Debug.WriteLin e(frmChild.Text Box1.Text)

Next

Ken

---------------------

"Adda" <an*******@disc ussions.microso ft.com> wrote in messagenews:19******* *************** *******@phx.gbl ...
If I cycle through the MdiChildActivat e event of the
parent form I can read text in a textbox on the child
mdiform --

console.writeli ne(Me.ActiveMdi Child.Controls( 1).Text)

But if I have a sub in the Parent form and reference a
child mdi form like this:

Sub ReadText()
Dim frm As New Form2
console.writeli ne(frm.txt1.tex t)
End Sub

--I can't read the text in the textbox of the child form. How could I read the text in a textbox of a child mdi form from a sub in the parent form?

TIA
Adda

.

Nov 20 '05 #4
Thank you. I also discovered that if I declare the
childform at the Form level of the Parent form as shared I
can also read the text in the textbox.

While I am at it, what I am actually trying to do is to
refresh a datagrid on the parent form with data that I
enter in the child form. I pass a datarow object to the
child and populate it and then update the dataset with a
dataAdapter (using a button on the childform or an Add
menu selection from the parent form). This works fine but
the new row doesn't show up in the datagrid on the parent
form until after I do a dataset.clear, dataAdatapter.F ill
(dataset, "tbl1") on the parent form from a menu event o
the Parent. Could you suggest a way that I could make the
new row show up in the datagrid when in the same event
that I update the dataset with the data from the childform?

Thank you again for your reply.
Adda

-----Original Message-----
Hi,

Dim frmChild As Form2

For Each frmChild In Me.MdiChildren

Debug.WriteLin e(frmChild.Text Box1.Text)

Next

Ken

---------------------

"Adda" <an*******@disc ussions.microso ft.com> wrote in messagenews:19******* *************** *******@phx.gbl ...
If I cycle through the MdiChildActivat e event of the
parent form I can read text in a textbox on the child
mdiform --

console.writeli ne(Me.ActiveMdi Child.Controls( 1).Text)

But if I have a sub in the Parent form and reference a
child mdi form like this:

Sub ReadText()
Dim frm As New Form2
console.writeli ne(frm.txt1.tex t)
End Sub

--I can't read the text in the textbox of the child form. How could I read the text in a textbox of a child mdi form from a sub in the parent form?

TIA
Adda

.

Nov 20 '05 #5
Hi,

post your code.

Ken
-----------
"Adda" <an*******@disc ussions.microso ft.com> wrote in message
news:16******** *************** ******@phx.gbl. ..
Thank you. I also discovered that if I declare the
childform at the Form level of the Parent form as shared I
can also read the text in the textbox.

While I am at it, what I am actually trying to do is to
refresh a datagrid on the parent form with data that I
enter in the child form. I pass a datarow object to the
child and populate it and then update the dataset with a
dataAdapter (using a button on the childform or an Add
menu selection from the parent form). This works fine but
the new row doesn't show up in the datagrid on the parent
form until after I do a dataset.clear, dataAdatapter.F ill
(dataset, "tbl1") on the parent form from a menu event o
the Parent. Could you suggest a way that I could make the
new row show up in the datagrid when in the same event
that I update the dataset with the data from the childform?

Thank you again for your reply.
Adda

-----Original Message-----
Hi,

Dim frmChild As Form2

For Each frmChild In Me.MdiChildren

Debug.WriteLin e(frmChild.Text Box1.Text)

Next

Ken

---------------------

"Adda" <an*******@disc ussions.microso ft.com> wrote in

message
news:19******* *************** *******@phx.gbl ...
If I cycle through the MdiChildActivat e event of the
parent form I can read text in a textbox on the child
mdiform --

console.writeli ne(Me.ActiveMdi Child.Controls( 1).Text)

But if I have a sub in the Parent form and reference a
child mdi form like this:

Sub ReadText()
Dim frm As New Form2
console.writeli ne(frm.txt1.tex t)
End Sub

--I can't read the text in the textbox of the child form. How could I read the text in a textbox of a child mdi form from a sub in the parent form?

TIA
Adda

.

Nov 20 '05 #6
Hi,

post your code.

Ken
-----------
"Adda" <an*******@disc ussions.microso ft.com> wrote in message
news:16******** *************** ******@phx.gbl. ..
Thank you. I also discovered that if I declare the
childform at the Form level of the Parent form as shared I
can also read the text in the textbox.

While I am at it, what I am actually trying to do is to
refresh a datagrid on the parent form with data that I
enter in the child form. I pass a datarow object to the
child and populate it and then update the dataset with a
dataAdapter (using a button on the childform or an Add
menu selection from the parent form). This works fine but
the new row doesn't show up in the datagrid on the parent
form until after I do a dataset.clear, dataAdatapter.F ill
(dataset, "tbl1") on the parent form from a menu event o
the Parent. Could you suggest a way that I could make the
new row show up in the datagrid when in the same event
that I update the dataset with the data from the childform?

Thank you again for your reply.
Adda

-----Original Message-----
Hi,

Dim frmChild As Form2

For Each frmChild In Me.MdiChildren

Debug.WriteLin e(frmChild.Text Box1.Text)

Next

Ken

---------------------

"Adda" <an*******@disc ussions.microso ft.com> wrote in

message
news:19******* *************** *******@phx.gbl ...
If I cycle through the MdiChildActivat e event of the
parent form I can read text in a textbox on the child
mdiform --

console.writeli ne(Me.ActiveMdi Child.Controls( 1).Text)

But if I have a sub in the Parent form and reference a
child mdi form like this:

Sub ReadText()
Dim frm As New Form2
console.writeli ne(frm.txt1.tex t)
End Sub

--I can't read the text in the textbox of the child form. How could I read the text in a textbox of a child mdi form from a sub in the parent form?

TIA
Adda

.

Nov 20 '05 #7
Sorry, had to step away for a couple of hours. Not at my
desk right now, but the code goes something like the
following:

--in the parent form--------------------

Public Class Parentfrm
Dim ddRow As DataRow
....
Public Property dRow() As DataRow
Get
Return ddRow
End Get
Set(ByVal Value As DataRow)
ddRow = Value
End Set
End Property

Public Sub AddRow()
dataset1.Tables ("tbl1").Rows.A dd(ddRow)
dataAdapter1.Up date(dataset1, "tbl1")
Me.Refresh
'how to refresh datagrid1?
End Sub
....
----------------------------------------------
--in the Child Form---------------------------
....
Private Sub btnAdd(...)...
Dim frm As New Parentfrm
frm.dRow = frm.dataset1.Ta bles("tbl1").Ne wRow
frm.dRow(0) = txt0.Text
frm.dRow(1) = txt1.Text
frm.AddRow()
End Sub
-----------------------------------------------

tbl1 resides in a sql Server database. The data is
getting stored correctly. But the new row does not show
up in datagrid1 until I click on a menu event on the
parent form

---------------------------------------------
Private Sub mnuRefresh(...) ...
dataset1.clear( )
dataAdapter1.Fi ll(dataset1, "tbl1")
End Sub
-----------------------------------------------

now the new row shows up in datagrid1. I am hoping that I
could accomplish this when I do dataAdapter.Upd ate(...).
If I perform this operation from Parentfrm datagrid1
updates automatically. But if I do it from the childform
it does not.

Any suggestions greatly appreciated on how to get
datagrid1 to update automatically when adding data from
the childform. Thank you very much for your help.

Adda

-----Original Message-----
Hi,

post your code.

Ken
-----------
"Adda" <an*******@disc ussions.microso ft.com> wrote in messagenews:16******* *************** *******@phx.gbl ...
Thank you. I also discovered that if I declare the
childform at the Form level of the Parent form as shared I can also read the text in the textbox.

While I am at it, what I am actually trying to do is to
refresh a datagrid on the parent form with data that I
enter in the child form. I pass a datarow object to the
child and populate it and then update the dataset with a
dataAdapter (using a button on the childform or an Add
menu selection from the parent form). This works fine but the new row doesn't show up in the datagrid on the parent form until after I do a dataset.clear, dataAdatapter.F ill (dataset, "tbl1") on the parent form from a menu event o
the Parent. Could you suggest a way that I could make the new row show up in the datagrid when in the same event
that I update the dataset with the data from the childform?
Thank you again for your reply.
Adda

>-----Original Message-----
>Hi,
>
>Dim frmChild As Form2
>
>For Each frmChild In Me.MdiChildren
>
>Debug.WriteLin e(frmChild.Text Box1.Text)
>
>Next
>
>
>
>Ken
>
>---------------------
>
>"Adda" <an*******@disc ussions.microso ft.com> wrote in

message
>news:19******* *************** *******@phx.gbl ...
>> If I cycle through the MdiChildActivat e event of the
>> parent form I can read text in a textbox on the child
>> mdiform --
>>
>> console.writeli ne(Me.ActiveMdi Child.Controls( 1).Text)
>>
>> But if I have a sub in the Parent form and reference a >> child mdi form like this:
>>
>> Sub ReadText()
>> Dim frm As New Form2
>> console.writeli ne(frm.txt1.tex t)
>> End Sub
>>
>> --I can't read the text in the textbox of the child

form.
>> How could I read the text in a textbox of a child mdi

form
>> from a sub in the parent form?
>>
>> TIA
>> Adda
>
>
>.
>

.

Nov 20 '05 #8
Sorry, had to step away for a couple of hours. Not at my
desk right now, but the code goes something like the
following:

--in the parent form--------------------

Public Class Parentfrm
Dim ddRow As DataRow
....
Public Property dRow() As DataRow
Get
Return ddRow
End Get
Set(ByVal Value As DataRow)
ddRow = Value
End Set
End Property

Public Sub AddRow()
dataset1.Tables ("tbl1").Rows.A dd(ddRow)
dataAdapter1.Up date(dataset1, "tbl1")
Me.Refresh
'how to refresh datagrid1?
End Sub
....
----------------------------------------------
--in the Child Form---------------------------
....
Private Sub btnAdd(...)...
Dim frm As New Parentfrm
frm.dRow = frm.dataset1.Ta bles("tbl1").Ne wRow
frm.dRow(0) = txt0.Text
frm.dRow(1) = txt1.Text
frm.AddRow()
End Sub
-----------------------------------------------

tbl1 resides in a sql Server database. The data is
getting stored correctly. But the new row does not show
up in datagrid1 until I click on a menu event on the
parent form

---------------------------------------------
Private Sub mnuRefresh(...) ...
dataset1.clear( )
dataAdapter1.Fi ll(dataset1, "tbl1")
End Sub
-----------------------------------------------

now the new row shows up in datagrid1. I am hoping that I
could accomplish this when I do dataAdapter.Upd ate(...).
If I perform this operation from Parentfrm datagrid1
updates automatically. But if I do it from the childform
it does not.

Any suggestions greatly appreciated on how to get
datagrid1 to update automatically when adding data from
the childform. Thank you very much for your help.

Adda

-----Original Message-----
Hi,

post your code.

Ken
-----------
"Adda" <an*******@disc ussions.microso ft.com> wrote in messagenews:16******* *************** *******@phx.gbl ...
Thank you. I also discovered that if I declare the
childform at the Form level of the Parent form as shared I can also read the text in the textbox.

While I am at it, what I am actually trying to do is to
refresh a datagrid on the parent form with data that I
enter in the child form. I pass a datarow object to the
child and populate it and then update the dataset with a
dataAdapter (using a button on the childform or an Add
menu selection from the parent form). This works fine but the new row doesn't show up in the datagrid on the parent form until after I do a dataset.clear, dataAdatapter.F ill (dataset, "tbl1") on the parent form from a menu event o
the Parent. Could you suggest a way that I could make the new row show up in the datagrid when in the same event
that I update the dataset with the data from the childform?
Thank you again for your reply.
Adda

>-----Original Message-----
>Hi,
>
>Dim frmChild As Form2
>
>For Each frmChild In Me.MdiChildren
>
>Debug.WriteLin e(frmChild.Text Box1.Text)
>
>Next
>
>
>
>Ken
>
>---------------------
>
>"Adda" <an*******@disc ussions.microso ft.com> wrote in

message
>news:19******* *************** *******@phx.gbl ...
>> If I cycle through the MdiChildActivat e event of the
>> parent form I can read text in a textbox on the child
>> mdiform --
>>
>> console.writeli ne(Me.ActiveMdi Child.Controls( 1).Text)
>>
>> But if I have a sub in the Parent form and reference a >> child mdi form like this:
>>
>> Sub ReadText()
>> Dim frm As New Form2
>> console.writeli ne(frm.txt1.tex t)
>> End Sub
>>
>> --I can't read the text in the textbox of the child

form.
>> How could I read the text in a textbox of a child mdi

form
>> from a sub in the parent form?
>>
>> TIA
>> Adda
>
>
>.
>

.

Nov 20 '05 #9
Hi,

Try rebinding the datagrid. Datagrid1.Datas ource = ds.tables(0)

Ken
----------
"Adda" <an*******@disc ussions.microso ft.com> wrote in message
news:19******** *************** ******@phx.gbl. ..
Sorry, had to step away for a couple of hours. Not at my
desk right now, but the code goes something like the
following:

--in the parent form--------------------

Public Class Parentfrm
Dim ddRow As DataRow
...
Public Property dRow() As DataRow
Get
Return ddRow
End Get
Set(ByVal Value As DataRow)
ddRow = Value
End Set
End Property

Public Sub AddRow()
dataset1.Tables ("tbl1").Rows.A dd(ddRow)
dataAdapter1.Up date(dataset1, "tbl1")
Me.Refresh
'how to refresh datagrid1?
End Sub
...
----------------------------------------------
--in the Child Form---------------------------
...
Private Sub btnAdd(...)...
Dim frm As New Parentfrm
frm.dRow = frm.dataset1.Ta bles("tbl1").Ne wRow
frm.dRow(0) = txt0.Text
frm.dRow(1) = txt1.Text
frm.AddRow()
End Sub
-----------------------------------------------

tbl1 resides in a sql Server database. The data is
getting stored correctly. But the new row does not show
up in datagrid1 until I click on a menu event on the
parent form

---------------------------------------------
Private Sub mnuRefresh(...) ...
dataset1.clear( )
dataAdapter1.Fi ll(dataset1, "tbl1")
End Sub
-----------------------------------------------

now the new row shows up in datagrid1. I am hoping that I
could accomplish this when I do dataAdapter.Upd ate(...).
If I perform this operation from Parentfrm datagrid1
updates automatically. But if I do it from the childform
it does not.

Any suggestions greatly appreciated on how to get
datagrid1 to update automatically when adding data from
the childform. Thank you very much for your help.

Adda

-----Original Message-----
Hi,

post your code.

Ken
-----------
"Adda" <an*******@disc ussions.microso ft.com> wrote in

message
news:16******* *************** *******@phx.gbl ...
Thank you. I also discovered that if I declare the
childform at the Form level of the Parent form as shared I can also read the text in the textbox.

While I am at it, what I am actually trying to do is to
refresh a datagrid on the parent form with data that I
enter in the child form. I pass a datarow object to the
child and populate it and then update the dataset with a
dataAdapter (using a button on the childform or an Add
menu selection from the parent form). This works fine but the new row doesn't show up in the datagrid on the parent form until after I do a dataset.clear, dataAdatapter.F ill (dataset, "tbl1") on the parent form from a menu event o
the Parent. Could you suggest a way that I could make the new row show up in the datagrid when in the same event
that I update the dataset with the data from the childform?
Thank you again for your reply.
Adda
>-----Original Message-----
>Hi,
>
>Dim frmChild As Form2
>
>For Each frmChild In Me.MdiChildren
>
>Debug.WriteLin e(frmChild.Text Box1.Text)
>
>Next
>
>
>
>Ken
>
>---------------------
>
>"Adda" <an*******@disc ussions.microso ft.com> wrote in
message
>news:19******* *************** *******@phx.gbl ...
>> If I cycle through the MdiChildActivat e event of the
>> parent form I can read text in a textbox on the child
>> mdiform --
>>
>> console.writeli ne(Me.ActiveMdi Child.Controls( 1).Text)
>>
>> But if I have a sub in the Parent form and reference a >> child mdi form like this:
>>
>> Sub ReadText()
>> Dim frm As New Form2
>> console.writeli ne(frm.txt1.tex t)
>> End Sub
>>
>> --I can't read the text in the textbox of the child
form.
>> How could I read the text in a textbox of a child mdi
form
>> from a sub in the parent form?
>>
>> TIA
>> Adda
>
>
>.
>

.

Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2898
by: James Norton-Jones | last post by:
Hi, Am I trying to hold the data of a DataGrid in a label so that when the form is reposted the DataGrid can be repopulated. The problem I am having is that I don't understand how to get the text into a stream in order to be able to use DataSetOutcomes1.ReadXML(MyStream). Thanks in advance, James
16
453
by: Adda | last post by:
If I cycle through the MdiChildActivate event of the parent form I can read text in a textbox on the child mdiform -- console.writeline(Me.ActiveMdiChild.Controls(1).Text) But if I have a sub in the Parent form and reference a child mdi form like this: Sub ReadText()
0
9895
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9741
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11011
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10666
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10724
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10351
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7899
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5929
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4546
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.