473,394 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Problem with multiple forms

Hello,

My application makes use of multiple forms. The problem is that if one form
is loaded and shown, and I close this form to go back to the previous form,
the previous form is displayed, but sometimes the focus is returned to a
background app, and not the main app.

My code to show the next form:

Private Sub btnStock_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnStock.Click
Dim frmStockGUI As New frmStock
Me.Hide()
frmStockGUI.btnStockCreate.Select()
frmStockGUI.ShowDialog()
Me.Show()
btnStock.Focus()
End Sub

I even set the focus to a button on the main form, but no luck :-(

Any ideas?

Kind regards,
Pieter Kruger

Nov 21 '05 #1
2 945
Hi,

Try me.focus instead of me.show
Ken
-------------------
"pkruger" <pk*****@discussions.microsoft.com> wrote in message
news:B5**********************************@microsof t.com...
Hello,

My application makes use of multiple forms. The problem is that if one form
is loaded and shown, and I close this form to go back to the previous form,
the previous form is displayed, but sometimes the focus is returned to a
background app, and not the main app.

My code to show the next form:

Private Sub btnStock_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnStock.Click
Dim frmStockGUI As New frmStock
Me.Hide()
frmStockGUI.btnStockCreate.Select()
frmStockGUI.ShowDialog()
Me.Show()
btnStock.Focus()
End Sub

I even set the focus to a button on the main form, but no luck :-(

Any ideas?

Kind regards,
Pieter Kruger
Nov 21 '05 #2
Hi,

Thank you, this solved my problem.

Best regards,
Pieter

"Ken Tucker [MVP]" wrote:
Hi,

Try me.focus instead of me.show
Ken
-------------------


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: L Major | last post by:
Hi Unfortunately, I am limited to using tables for part of my current project. I have a form that spans across a number of TR and TD in the shape of checkboxes. Doctype is XHTML 1.0...
11
by: Sagaert Johan | last post by:
I have made a custom control that draws a rectangle when the mouse is down, and does nothing when the mouse is up. I set/reset a flag in MouseDown/Mouse up and use this to do the drawing in the...
0
by: jon | last post by:
Using Visual C++ and MFC, one could generate a very nice MMI using CFormView and the method detailed in the MSDN "vswap" example to allow multiple forms to be viewed ( switched to ) within a single...
2
by: John Granade | last post by:
I'm looking for the best way to make a dataset available from multiple Windows forms. The dataset is created from an XML file. I have a main form (frmMain) that loads the dataset and reads the...
0
by: Becker | last post by:
I have a datatable that I use to display running processes. These running processes are spawned as different threads. I use the readerwriterlock class to ensure that when I write to the datatable,...
39
by: Marcin Zmyslowski | last post by:
Hello all! I have the following problem with MS Access 2003 permissions. I have two users. One is admin and the second one is user who has full permissions to enter modify and read data. I...
3
by: imrantbd | last post by:
This is my first problem.Please help me. I have the following code: <head> <script language="JavaScript"> function addSrcToDestList() { destList1 = window.document.forms.destList; srcList...
3
by: imrantbd | last post by:
I need array type name like "destList" must use for my destlist select box,not a single name.Or need a solution to capture multiple value of "destList" select box and send all selected value in php...
6
by: Bob Alston | last post by:
Looking for someone with experience building apps with multiple instances of forms open. I am building an app for a nonprofit organizations case workers. They provide services to the elderly. ...
1
by: brightlight | last post by:
Hello I want to search for multiple barcodes in our local network. I am using C# and my problem is I can not build succesful Loops to search multiple barcodes. Since I need to wait for the page...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.