RBirney wrote:
When i load a form (frmcontract) in the program i write i can load a contract
(cbocontract) as well as many other things, also in this form i can load
another form to deal with expenditure (frmexpenditure) by pressing a button.
Previously in VB6 i could call the data from the cbocontract field in
frmcontract from frmexpenditure by saying:
whatever=frmcontract.cbocontract.text
In VB.NET i can't do this and no matter how hard i try (obviously not hard
enough) i can't find a way of doing it. How is it done?
Is frmcontract visible to your frmexpenditure? IOW, is that a global
variable? If not, then frmexpenditure doesn't know that variable and the
code doesn't work. Now if you always call frmexpenditure only from
frmcontract, you could try me.parent.cbocontract.text, presuming you
called the form as follows from frmcontract:
dim frmExpenditure as new clsExpenditure() 'I always call my form
clsSomething so I can call the referring vars frmSomething
frmExpenditure.showdialog(me)
or something similar.
Another way could be to define a public var in your frmexpenditure like
Dim cContract as String()
Then in frmContract do something like:
dim frmExpenditure as new clsExpenditure()
frmExpenditure.cContract="whatever"
frmExpenditure.showdialog(me)
Then you'd have a var cContract available in your Expenditure form.
Rinze van Huizen