Pass value from one form to another

missshhhh

Member
Joined
Nov 26, 2006
Messages
13
Programming Experience
3-5
Hi, i have Form A that calls Form B. After choosing a value from the grid on Form B, i would return a value to Form A. My problem is how would I pass the value to form A? I simply cannot create a new instance of Form A because it contains values.
 
FormB is a class. You can add a public property to this class that will return the info you want. Internally you might need also a private field/variable to hold data after some event occured, then use this privately stored info when someone request the property.
Example caller:
VB.NET:
dim c as new childform
if c.showdialog = dialogresult.ok then
  msgbox(c.gridinfo)
end if
example internal childform:
VB.NET:
private thegridinfo as string
 
public readonly property gridinfo as string
get
  return me.thegridinfo
end get
end property
 
Back
Top