Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

form set focus vb.net

Posted on 2006-07-13
4
Medium Priority
?
1,770 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 1600 total points
ID: 17099703
try this:

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

Assisted Solution

by:manch
manch earned 400 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

604 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