473,778 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling forms from a Form

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
5 2248
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
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.goo glegroups.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
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 StoreInformatio n1 As Form

End Class

Also from form StoreSelection;

Dim frminfo1 As New StoreInformatio n1

'Set up values for storeinform1 screen

frminfo1.LegalN ame1.Text = myDV(rowIndex)( "LEGAL_NAME_LIN E1").ToString ()

frminfo1.LegalN ame2.Text = myDV(rowIndex)( "LEGAL_NAME_LIN E2").ToString ()

frminfo1.StoreO wner.Text = myDV(rowIndex)( "STORE_OWNER"). ToString()

From a form called StoreInformatio n that is called from StoreSelection
using;

Dim frminfo As New StoreInformatio n

'Set up values for storeinfor screen

frminfo.LegalNa me1.Text = myDV(rowIndex)( "LEGAL_NAME_LIN E1").ToString ()

frminfo.Show()

From StoreInformatio n I'm trying to see the form StoreInformatio n1 using the
following code, I'm not putting any data in the form here, it was all added
in StoreSelction.V B

Private Sub NextButton_Clic k(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles NextButton.Clic k

myFormLibrary.S toreInformation 1.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 StoreInformatio n form but I
see StoreSelection form instead of the StoreInformatio n1 form.

THanks,

Steve

"ag" <na******@gmail .com> wrote in message
news:11******** **************@ y43g2000cwc.goo glegroups.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
ag
As you said that VS not giving any error on compilation(inc luding
green-warning), I think its not the coding problem. May be some logical
problem is there.

What is your declaration of "StoreInformati on" ? Is it same as
"StoreInformati on1" as you mentioned as "Public Shared
StoreInformatio n1 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. StoreInformatio n1.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
Thanks for your reply.

The Showdialog and rearranging the order did not work.

Thanks

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

What is your declaration of "StoreInformati on" ? Is it same as
"StoreInformati on1" as you mentioned as "Public Shared
StoreInformatio n1 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. StoreInformatio n1.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
600
by: headware | last post by:
I know that you can call the method of one from from inside another form by doing something like this Forms("MyForm").MyFunction(12, 34) However, you have to know that MyForm has a function called MyFunction. Can you specify a string for the function name like you can with the form name? That is can I do something like Forms("MyForm")."MyFunction"
14
3013
by: ericellsworth | last post by:
Hi, I'm trying to use a class to pass variables back and forth from a form opened in dialog mode. I have created a class which invokes a form in its show method, like so: Public Sub Show() ' This method shows the form used to get the info If sWhereInt = "" Then DoCmd.OpenForm sFormNameInt, acNormal, , , acFormAdd, _
2
9783
by: Tony Liu | last post by:
Hi, I want to get the name of the calling function of an executing function, I use the StackTrace class to do this and it seems working. However, does anyone think that there any side effect towards this approach such as how would it works in multi-thread. Thanks Tony
6
17576
by: Jon Hyland | last post by:
Ok, I'm a little rusty on this, it should be a simple problem but I can't figure it out. How can I handle form events in my main code page?? I'm creating a Windows App in C#. Rather than make my main form the startup object, I'd rather put my Main() function in a class or code file. Why? Because thats what I always do in standard C++ or VB. In my opinion, writing all my application logic in the form itself is sloppy and only for...
2
2211
by: Harold | last post by:
I have page A with form field and a button and when button is clicked it opens page B in another window. Page B has a treeview control and that is all. When something is selected I want the page B item to pouplate a form field on page A. Can this be done and how?
6
1709
by: Amjad | last post by:
Hi, I want to make a project that calls and executes a function (VB code) made in a seperate file in the Application Folder. I know I can create the function in my project and call it internally, but I want to put the function's code in an external file, so that future updates to the function will require a replacing the function file instead of re-installing the whole project. Can you give me ideas on how I can make small updates to my...
4
2255
by: Bugs | last post by:
Hi, I wonder if anyone can help me out. I'm building a vb.net application that has a form with a panel that contains several other sub forms (as a collection of controls). What I'm wanting to do is call a generically named public sub in the top-most sub form in the panel. I have the name of the top-most form as a string (eg. g_TopForm = "frmCustomers") and I can reference the form with:
7
2949
by: Lee Crabtree | last post by:
I remember when I was first getting into .NET Forms programming that there was a rather emphatic rule about not constructing a form before calling Application.Run with it. So this: Application.Run(new Form1()); was okay, but this: Form1 form = new Form1();
1
1752
by: SAL | last post by:
Hello, I'm developing this remoting app (.net 2.0) and I need to bring the server app's form to the front often. Since you can not do cross-thread communication on a form or control without using Invoke, I declared a delegate to handle the cross-thread call to bring the form forward. Here's my code: Delegate Sub BringMeFront() Public myDelBringFormFront As BringMeFront
0
9629
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9465
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10296
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10068
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.