Solved

opening form within another form and keeping open

Posted on 2004-09-25
4
267 Views
Last Modified: 2010-04-23
i have form1 which opens on top of form 2(show,not show dialog aka modal), i want form2 to stay open even if the user clicks on form1, how this is done???

I also want to set the focus to textbox1 on form2 once its opened
0
Comment
Question by:DelphiCurious
  • 2
4 Comments
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 12150342
I'm not sure, but I think you worded the question incorrectly.

>> i have form1 which opens on top of form 2(show,not show dialog aka modal), i want form2 to stay open even if the user clicks on form1, how this is done???

Should be...?

>> i have form2 which opens on top of form1 (show,not show dialog aka modal), i want form2 to stay open even if the user clicks on form1, how this is done???

If I am correct, then these two settings will make that happen:

    Set the TopMost property of Form2 to True.
    Set the TabIndex of TextBox1 to 0 (zero).

Regards,

Idle_Mind
0
 
LVL 18

Expert Comment

by:DotNetLover_Baan
ID: 12151771
>>"i want form2 to stay open even if the user clicks on form1"<<
Do you mean to keep Form2 front most ? even if you click on Form1 ? If yes, you are talking about ShowDialog().
If not, just use Form2.Show, which is going to keep Form2 open until you close it.

Still I am not sure what you are trying to achieve. Please explain
-Baan
0
 

Author Comment

by:DelphiCurious
ID: 12153077
Idle_Mind you are correct, i worded it wrong,u solved the problem i had with the forms and but setting the focus of the textbox aint working. The textbox is on a tabpage, i tried to set the tabcontrol's index to 0 and the textbox within it to 0  but it still wont work
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 425 total points
ID: 12153099
After you show the form, you can set the selected tab and then give the textbox the focus like so:

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim f3 As New Form3
        f3.Show()
        f3.TabControl1.SelectedIndex = 1 ' select the 2nd tab
        f3.TextBox3.Focus() ' TextBox3 is on the 2nd tab
    End Sub

~IM
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Complex SQL statement in VB.NET 7 39
Name Space error VS2015 1 35
Crystal reports login after closing form 3 34
VB.Net Data Class 1 16
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question