Solved

opening form within another form and keeping open

Posted on 2004-09-25
4
262 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now