By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,729 Members | 1,487 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,729 IT Pros & Developers. It's quick & easy.

Whats the best class way to do this

P: n/a
Hi,

I have an app with three forms.

a) Master form. It has a grid with a list of contact names on it.
b) Contact form. This form is where you can edit/create a new contact
c) address form. This form is a popup launch from the contact form to enter
the contacts address.

I have created a basic class for the contact object. What I want to do, is
to only create the class when I load the contact form, and then destroy it
when I close that form. My problem is that if I create the class within form
b, then when the user, uses form c to enter the contact details, they will
not be able to access the class, as it is link to form b.

How is the best way to get the address details in form c, into the class
living in form b?

Hope that makes sense!

Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Cor
Hi Aussie,

I think you can use a dialogform
Rough written
\\\\
In formB
dim frmC as new formC
frmC.showdialog(me)
adresInB = frmC.adres
nameInB=frmC.name
etc
frmC.dispose
////
frmC.adres ietc are either a public read only properties in formC or a
public variables in formC that is what you wish.

I hope this was the meaning?
Cor
Nov 20 '05 #2

P: n/a
"news.microsoft.com" <au****@aussie.com> wrote...
How is the best way to get the address details in form c, into the class
living in form b?


You should be able to add a reference to the object in FormC and simply
assign that reference from FormB (which I assume creates the form) just
before it displays the pop-up form.
Nov 20 '05 #3

P: n/a
Hi News.ms,

This is one of those order a hundred cats - we're going skinning issues.
So here's another method. ;-)

In this one, Form C provides a function which does the showing and returns
a value. This simpifies the calling from the originating Form (B). It also
allows Form C to be called from other Forms without knowing anything about
them. All that's required is that Form B knows about the ShowAndTell method.

Class FormC
Public Function ShowAndTell As SomeResultType
Me.ShowDialog
Dim oResult As SomeResultType
oResult.This = SomeValue
oResult.That = SomeOtherValue
Return oResult
End Sub

In FormB
Dim frmC As new FormC
Dim oResult As SomeResultType = frmC.ShowAndTell
'oResult now contains juicy goodies.

Regards,
Fergus
Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.