954,164 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Related to Forms Property

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.

manoj_582033
Light Poster
39 posts since Nov 2008
Reputation Points: 10
Solved Threads: 2
 

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?

vb5prgrmr
Posting Virtuoso
1,912 posts since Mar 2009
Reputation Points: 156
Solved Threads: 296
 

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[/code]
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

vb5prgrmr
Posting Virtuoso
1,912 posts since Mar 2009
Reputation Points: 156
Solved Threads: 296
 

Thank's For Reply, It Is Working Now

manoj_582033
Light Poster
39 posts since Nov 2008
Reputation Points: 10
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You