Hi Friends
I M Using vb6, i have a problem in this that when i execute my s/w so only, any single form becomes open at a time but i want that multiple forms must work together, Please Help Me.
Hi Friends
I M Using vb6, i have a problem in this that when i execute my s/w so only, any single form becomes open at a time but i want that multiple forms must work together, Please Help Me.
I think we are going to need a better explanation of what you want to do, because from reading your OP I can think of several things and some of them seem to be contrary to what you little sentance says...
So are you wanting to create a wizard like application in that the user goes from one form to the next filling out options?
Are you wanting several forms displayed at same time and when information changes on one it changes on the others?
Are you asking how to pass information from one form to another?
HI
Thank's to reply
accualy i want that several forms displayed at same time and when information changes on one it changes on the others,but in my application when a form is desplaying on dektop,& i m clicking on other form so that's not opening.
Above is quote from PM...
Okay, when displaying several forms (and this is just a quick example) you can do something like this (however this reuses the same form so is not directly related to what you want to do with different forms but as for a visual example it works)...
Option Explicit
Private Sub Command1_Click()
Dim F As Form
Set F = New Form1
F.Left = 0
F.Top = 0
F.Width = Screen.Width / 2
F.Height = Screen.Height / 2
F.Show
Set F = New Form1
F.Left = Screen.Width / 2
F.Top = 0
F.Width = Screen.Width / 2
F.Height = Screen.Height / 2
F.Show
Set F = New Form1
F.Left = 0
F.Top = Screen.Height / 2
F.Width = Screen.Width / 2
F.Height = Screen.Height / 2
F.Show
Me.Left = Screen.Width / 2
Me.Top = Screen.Height / 2
Me.Width = Screen.Width / 2
Me.Height = Screen.Height / 2
End Sub
but if you have done something like this...
Option Explicit
Private Sub Command1_Click()
Dim F As Form
Set F = New Form1
F.Show vbModal, Me
End Sub
then each form will display on top of one another and you will not be able to access any of the forms underneath until you close the top one.
Soooo, what does this mean you ask???? Well, when showing your multiple forms you probably want to do something like this...
Private Sub Command1_Click()
Form2.Show
End Sub
Private Sub Command2_Click()
Form3.Show
End Sub
Private Sub Command3_Click()
Form4.Show
End Sub
Now, if you want to have a form that stays behind others you can do this...
Private Sub Command1_Click()
Form2.Show vbModeless, Me
End Sub
Private Sub Command2_Click()
Form3.Show vbModeless, Me
End Sub
Private Sub Command3_Click()
Form4.Show vbModeless, Me
End Sub
This will keep forms 2, 3, and 4, on top of Form1 but you will still be able to interact with form1.
Okay, now for passing information from one form to another....
The most direct method is to pass information from whatever controls event in the form that has focus is to directly call any of the following in the other form...
Control like text box to utilize its change event
Private Sub Command1_Click()
Form1.Text1.Text = Form2.Command1.Caption
End Sub
Or a public declared sub/function...
Public Function MyForm1PublicFunction(MyStringToPass As String) As String
'do stuff
End Function
and it would be called like so...
Private Sub Command1_Click()
If MyForm1PublicFunction (Form2.Command1.Caption) = "OK" Then
'do stuff
End If
End Sub
And the last direct way would be to modify the display from the form that has focus by using the direct method above...
'...
Form1.Label1.Caption = "Some string"
Form1.Text1.Caption = "Some string"
'...
Good Luck
Thank's For Reply, It Is Working Now
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.