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

Calling forms from a Form

P: n/a
I'm very new to VB.NET, or any VB.

I need to have form1 call form2 which calls form3, etc.

I am able to use oledb in form1 to get the data.

I build all the data for form2 and form3 from form1

I can call form2 from form1 without any probles, all the data is there. I
can change to call to form2 to form3 and all the data is there and I can see
the form with success.

I cannot get form2 to call form3.

I did set up a public class for my forms and was able to get all the data
transferred over and use the formclass.form3.show() to avoid the green error
indicator but when I execute that step nothing happens. I put a form2.hide()
in there and I do go back to form1. As expected.

Thanks,
Steve

Jun 3 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
ag


Look, if you want to track down your forms in your application, then
you need to create forms manually and keep the objects and when calling
another form, pass that object to another form by using any public
method.

lemme show u a pseodo code:

Form1
----------
Dim f2 As New Form2()
f2.xxx(f2)
f2.show

Form2
------------
// variable to store f2 objects
Dim myF2 as Form2

// then declare a public procedure

public xxx(ByVal f2 As Form2)
//
myF2=f2
//
end procedure

In that same way u can call Form3 also. If you want to send data to
form2 then just add an extra parameter on xxx().

Jun 4 '06 #2

P: n/a
Thanks,

I initially was going to try that but I could not figure how to get a data
record form the oledb call passed to second form so that it cold be used in
the thrid from, etc.

In My research I found this public class that was supposed to allow me to
populate the data in form3 from within form1 and than do a show of form3
from within form2, and the data elements would logically be there.

I guess what I need to know how to do would be to pass the record in
function xxx and be able to get at the data from within form2 to do the
form3 processing.

"ag" <na******@gmail.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...


Look, if you want to track down your forms in your application, then
you need to create forms manually and keep the objects and when calling
another form, pass that object to another form by using any public
method.

lemme show u a pseodo code:

Form1
----------
Dim f2 As New Form2()
f2.xxx(f2)
f2.show

Form2
------------
// variable to store f2 objects
Dim myF2 as Form2

// then declare a public procedure

public xxx(ByVal f2 As Form2)
//
myF2=f2
//
end procedure

In that same way u can call Form3 also. If you want to send data to
form2 then just add an extra parameter on xxx().

Jun 4 '06 #3

P: n/a
To further explain what I am currently doing that does not seem to work I'm
cutting actaul code here.

From a formd called StoreSelection:

Public Class myFormLibrary

Public Shared StoreInformation1 As Form

End Class

Also from form StoreSelection;

Dim frminfo1 As New StoreInformation1

'Set up values for storeinform1 screen

frminfo1.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

frminfo1.LegalName2.Text = myDV(rowIndex)("LEGAL_NAME_LINE2").ToString()

frminfo1.StoreOwner.Text = myDV(rowIndex)("STORE_OWNER").ToString()

From a form called StoreInformation that is called from StoreSelection
using;

Dim frminfo As New StoreInformation

'Set up values for storeinfor screen

frminfo.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

frminfo.Show()

From StoreInformation I'm trying to see the form StoreInformation1 using the
following code, I'm not putting any data in the form here, it was all added
in StoreSelction.VB

Private Sub NextButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles NextButton.Click

myFormLibrary.StoreInformation1.Show()

Me.Hide()

End Sub

I do not get any errors during compiling or green underlines in the Visual
Studio program. The Me.Hide() does remove the StoreInformation form but I
see StoreSelection form instead of the StoreInformation1 form.

THanks,

Steve

"ag" <na******@gmail.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...


Look, if you want to track down your forms in your application, then
you need to create forms manually and keep the objects and when calling
another form, pass that object to another form by using any public
method.

lemme show u a pseodo code:

Form1
----------
Dim f2 As New Form2()
f2.xxx(f2)
f2.show

Form2
------------
// variable to store f2 objects
Dim myF2 as Form2

// then declare a public procedure

public xxx(ByVal f2 As Form2)
//
myF2=f2
//
end procedure

In that same way u can call Form3 also. If you want to send data to
form2 then just add an extra parameter on xxx().

Jun 4 '06 #4

P: n/a
ag
As you said that VS not giving any error on compilation(including
green-warning), I think its not the coding problem. May be some logical
problem is there.

What is your declaration of "StoreInformation" ? Is it same as
"StoreInformation1" as you mentioned as "Public Shared
StoreInformation1 As Form" ?

Anyway, I am sure some Object related logical problem is there.

I dont know it'll solve your problem or not but give it a try:

Swap the position of
"myFormLibrary.StoreInformation1.Show()"
and
"Me.Hide()"

i.e. first do the Hide thing, then Show()

and 2nd try:

Try using "ShowDialog()" instead of "Show()"

Thanks,
ag

Jun 4 '06 #5

P: n/a
Thanks for your reply.

The Showdialog and rearranging the order did not work.

Thanks

"ag" <na******@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
As you said that VS not giving any error on compilation(including
green-warning), I think its not the coding problem. May be some logical
problem is there.

What is your declaration of "StoreInformation" ? Is it same as
"StoreInformation1" as you mentioned as "Public Shared
StoreInformation1 As Form" ?

Anyway, I am sure some Object related logical problem is there.

I dont know it'll solve your problem or not but give it a try:

Swap the position of
"myFormLibrary.StoreInformation1.Show()"
and
"Me.Hide()"

i.e. first do the Hide thing, then Show()

and 2nd try:

Try using "ShowDialog()" instead of "Show()"

Thanks,
ag

Jun 4 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.