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
Solved

opening form within another form and keeping open

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

861 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