943,660 Members | Top Members by Rank

Ad:
Jun 27th, 2009
0

Related to Forms Property

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 2
Light Poster
manoj_582033 is offline Offline
39 posts
since Nov 2008
Jun 27th, 2009
0

Re: Related to Forms Property

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?
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
Jun 29th, 2009
0

Re: Related to Forms Property

Quote ...
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)...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Option Explicit
  2.  
  3. Private Sub Command1_Click()
  4. Dim F As Form
  5.  
  6. Set F = New Form1
  7. F.Left = 0
  8. F.Top = 0
  9. F.Width = Screen.Width / 2
  10. F.Height = Screen.Height / 2
  11. F.Show
  12.  
  13. Set F = New Form1
  14. F.Left = Screen.Width / 2
  15. F.Top = 0
  16. F.Width = Screen.Width / 2
  17. F.Height = Screen.Height / 2
  18. F.Show
  19.  
  20. Set F = New Form1
  21. F.Left = 0
  22. F.Top = Screen.Height / 2
  23. F.Width = Screen.Width / 2
  24. F.Height = Screen.Height / 2
  25. F.Show
  26.  
  27. Me.Left = Screen.Width / 2
  28. Me.Top = Screen.Height / 2
  29. Me.Width = Screen.Width / 2
  30. Me.Height = Screen.Height / 2
  31. End Sub
but if you have done something like this...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Option Explicit
  2.  
  3. Private Sub Command1_Click()
  4. Dim F As Form
  5. Set F = New Form1
  6. F.Show vbModal, Me
  7. 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...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Command1_Click()
  2. Form2.Show
  3. End Sub
  4. Private Sub Command2_Click()
  5. Form3.Show
  6. End Sub
  7. Private Sub Command3_Click()
  8. Form4.Show
  9. End Sub

Now, if you want to have a form that stays behind others you can do this...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Command1_Click()
  2. Form2.Show vbModeless, Me
  3. End Sub
  4. Private Sub Command2_Click()
  5. Form3.Show vbModeless, Me
  6. End Sub
  7. Private Sub Command3_Click()
  8. Form4.Show vbModeless, Me
  9. 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
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Command1_Click()
  2. Form1.Text1.Text = Form2.Command1.Caption
  3. 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...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Command1_Click()
  2. If MyForm1PublicFunction (Form2.Command1.Caption) = "OK" Then
  3. 'do stuff
  4. End If
  5. 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...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. '...
  2. Form1.Label1.Caption = "Some string"
  3. Form1.Text1.Caption = "Some string"
  4. '...


Good Luck
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
Jul 3rd, 2009
0

Re: Related to Forms Property

Thank's For Reply, It Is Working Now
Reputation Points: 10
Solved Threads: 2
Light Poster
manoj_582033 is offline Offline
39 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Import and export mixed data from and to csv file in VBA6
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: AutoClicker





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC