Solved

opening form within another form and keeping open

Posted on 2004-09-25
4
268 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 86

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 86

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 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