Solved

form set focus vb.net

Posted on 2006-07-13
4
1,764 Views
Last Modified: 2012-08-13
In vb6 I would open a form, then set focus back to the form I was on, so the new form would be in the background.

how do I do this in vb.net?

        FrmTestCommands.Show()
        FrmMain.SetFocus()
0
Comment
Question by:jackjohnson44
[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 5

Accepted Solution

by:
tsay earned 400 total points
ID: 17099703
try this:

dim myTestForm as new FrmTestCommands
myTestForm.show()
me.focus
0
 
LVL 6

Assisted Solution

by:manch
manch earned 100 total points
ID: 17099716


U can write

   'Create the object for the form u want to show
    Dim objFrmTestCommands as FrmTestCommands

   'Instantiate the Object
    objFrmTestCommands = New FrmTestCommands
    'show the form u wanted
    objFrmTestCommands.Show()
    'and Then set the focus to the Main Form by the statement
    FrmMain.focus()
0
 
LVL 5

Expert Comment

by:tsay
ID: 17099727
that's like EXACTLY what I told, but only you use 2 times the code...
0
 
LVL 2

Expert Comment

by:cwile
ID: 17099771
This is a pretty dirty way, but it works


    Dim frm2 As New Form2
    Dim frm1 As New Form1

    frm2.Show()
    frm2.SendToBack()
    frm1.Show()
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

728 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