Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing txbox value in child form to mdi form

Status
Not open for further replies.

jpack23

Programmer
Dec 15, 2004
82
US
I have a save button on a toolstrip on the MDI parent form. I want to save values in textboxes on the child form when I click on this "save" button. In the button click event for the save button I cant get the value from the text boxes. I want to pass these text box values to another class property so I can save them to a database

Private Sub tsbtnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsbtnSubmit.Click


Dim objActivities As New Activities

objActivities.ValueOne = childform.txtboxone.text
objActivities.ValueTwo = childform.txtboxtwo.text
The value that show for the childform txtbox is nothing.

Can some help me with getting these value to the activities class properties using the a "save" button on the mdi form

thank you very much

Joe
 

faq796-5773


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
jebenson,

I am trying to use property to accomplish this task like the example:
Private Property ReceiveText() As String
Get
Return txtReceive.Text
End Get
Set(ByVal Value As String) txtReceive.Text = Value End Set
End Property

I reworked this a little bit, From my child form I set a property in another class called "textItems". On the Maind MDI form the save button calls a sub in a 3rd class call "Activity" where I want to get that text box value to validate and save to a database

Public Class textItems
Private mstrTextboxValueOne as String

#Region "Properties"
Public Property TxtValueOne() as Strign
Get
TxtValueOne = mstrTextBoxValueOne
End Get
Set(byVal Value As String)
mstrTextBoxValueOne = value
End Set
End Property
#End Region
End Class

From the child I set this property

Public sub SaveTextValues
Dim objTextValues as New textItems

With objtextValues
.TxtValueOne = txtBoxOne.text
End With

as far as I can tell this does save the value I can see the value in mstrTextBoxValueOne

on the parent form I have the save button

Public Class frmMainMDIParent

Private sub tsbtnSubmit_Click
dim objActivity as new Activity
objActivity.SubmitandValidate

End Sub
End Class


Public Class Activity
Public Sub SubmitandValidate
Dim strtextOneValue as String
Dim objTextBoxValues as new TextItems
strtextOneValue = objTextBoxValues.TxtValueOne
Validate(strtextOneValue)
**** at this point objTextBoxValues.TxtValueOne is reading as nothing.

end Class


Any help would be appreciated.

thanks very much for your time




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top