Ahmadal_najjar2003
asked on
Form call another form
I have a form that within it call another form , what I need is , when I Open the another form
lets say child one. I add new record , I want this record to be shown or saved in a variable
so I can use it in the main form.
lets say child one. I add new record , I want this record to be shown or saved in a variable
so I can use it in the main form.
You want to pass some information between forms ?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Both Solution Give me very good Idea , But the second solution of Priest04 , What I Need in this moment.
I think for another solution like this :
1- first add public variable within the MainForm of the projcet itself as = nothing
Public ReturnedFormString As String = Nothing
2- second , in the called form itself within Load event , set also the value = nothing
mainform.ReturnedFormStrin g = Nothing
3- In any place within the called (child form) set the value you want
for example
when save the new data set
mainform.ReturnedFormStrin g = ComboBox.text
4- use this value within the caller form if you wish .
dim str as string = mainform.ReturnedFormStrin g
I think for another solution like this :
1- first add public variable within the MainForm of the projcet itself as = nothing
Public ReturnedFormString As String = Nothing
2- second , in the called form itself within Load event , set also the value = nothing
mainform.ReturnedFormStrin
3- In any place within the called (child form) set the value you want
for example
when save the new data set
mainform.ReturnedFormStrin
4- use this value within the caller form if you wish .
dim str as string = mainform.ReturnedFormStrin
That is not a very good practice, it makes code maintaining very hard. Sometime in the future you will not know in what places you set this value, whicih could cause logical errors, and they are hardest to solve.
ASKER
Thats right. So that I reset this value to nothing in loading the form.
Nevertheless, its the same. Good practice is to have some property that will return value to the form that needs this value.
Goran
Goran
ASKER
Thank alot