Solved

form set focus vb.net

Posted on 2006-07-13
4
1,758 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
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
tsay earned 400 total points
Comment Utility
try this:

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

Assisted Solution

by:manch
manch earned 100 total points
Comment Utility


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
Comment Utility
that's like EXACTLY what I told, but only you use 2 times the code...
0
 
LVL 2

Expert Comment

by:cwile
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

10 Experts available now in Live!

Get 1:1 Help Now