Link to home
Start Free TrialLog in
Avatar of Ahmadal_najjar2003
Ahmadal_najjar2003Flag for Kuwait

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.
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

You want to pass some information between forms ?
SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ahmadal_najjar2003

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.ReturnedFormString = Nothing
   3- In any place within the called (child form) set the value you want
      for example
      when save the new data set
      mainform.ReturnedFormString = ComboBox.text
   4- use this value within the caller form if you wish .
       dim str as string = mainform.ReturnedFormString
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.
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
Thank alot