473,671 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form Appear

37 New Member
Hi

I have a form called Form1. When Form1 loads, another form, Form2, will appear. However, i want Form2 to appear in front of Form1. I tried doing the following but it doesn't seem to work. Form 2 still appear behind Form1.


Expand|Select|Wrap|Line Numbers
  1. Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  2.  
  3.         Form2.Show()
  4.         Form2.BringToFront()
  5.  
  6. End Sub
Nov 2 '07 #1
7 1182
debasisdas
8,127 Recognized Expert Expert
Question moved to .NET Forum.
Nov 2 '07 #2
balabaster
797 Recognized Expert Contributor
Hi

I have a form called Form1. When Form1 loads, another form, Form2, will appear. However, i want Form2 to appear in front of Form1. I tried doing the following but it doesn't seem to work. Form 2 still appear behind Form1.


Expand|Select|Wrap|Line Numbers
  1. Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  2.  
  3. Form2.Show()
  4. Form2.BringToFront()
  5.  
  6. End Sub
This appears to work on my system...

Expand|Select|Wrap|Line Numbers
  1.  Public Class Form1 
  2.   Private Sub Loaded(ByVal sender As Object, ByVal e As System.EventArgs) _
  3.   Handles MyBase.Load
  4.     Dim oFrm As Form = New Form2
  5.     oFrm.Show(Me)
  6.   End Sub
  7. End Class
Then in your splash screen (I'm assuming that's what you're using it for), you can have a timer to auto-close it after a period.
Nov 2 '07 #3
tigger
37 New Member
This appears to work on my system...

Expand|Select|Wrap|Line Numbers
  1.  Public Class Form1 
  2.   Private Sub Loaded(ByVal sender As Object, ByVal e As System.EventArgs) _
  3.   Handles MyBase.Load
  4.     Dim oFrm As Form = New Form2
  5.     oFrm.Show(Me)
  6.   End Sub
  7. End Class
Then in your splash screen (I'm assuming that's what you're using it for), you can have a timer to auto-close it after a period.

The code works, thanks. However, i have some problem with focusing it. Even though my Form2 appears in front of my Form1, the form is grayed. I need to click on the form, then the focus is on the textbox in the form. I tried 'Form2.nameText Box.Focus()' in the load event but it doesnt work. How do i make the focus go to text box once Form2 loads?
Nov 21 '07 #4
none
3 New Member
could you try on form2 load just textbox.focus?
Nov 21 '07 #5
tigger
37 New Member
could you try on form2 load just textbox.focus?
I tried but it doesn't work. I also put it in my Form1 but still, the textbox is not focused.
Nov 23 '07 #6
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
Could you please confirm that the Enabled Property of Form2 is set to true?
Nov 23 '07 #7
tigger
37 New Member
Could you please confirm that the Enabled Property of Form2 is set to true?
It's already set to true. I've already managed to solve it. Thanks. I used oFrm.ShowDialog (Me) instead and it works.
Nov 23 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

5
6084
by: Richard Cornford | last post by:
I am interested in hearing opinions on the semantic meaning of FORM (elements) in HTML. I have to start of apologising because this question arose in a context that is not applicable to the Internet. Specifically, marking up a document that will contain multiple related form controls (intended exclusively for client-side scripting) that would never be intended to be submitted. I realise that that concept is a non-starter in an Internet...
1
1619
by: Howard Jess | last post by:
Apparently, form elements of type <input type="image" src="...> are not included in the form's elements collection. I don't understand why not; according to DOM2, all form control elements in the form are part of the elements collection. Further, this element doesn't appear in the (DOM0) document.images collection either; so it's really not well-accounted for.
3
4980
by: Steve | last post by:
Form FrmRestock's recordsource is QryFrmRestock. The TransactionDate field's criteria is set ats: Forms!FrmRestock!LastXDays. LastXDays on the form is a combobox where the selections are 30, 60 and 90. The default is set at 30. Question1: When the form opens, there are no records displayed although there are many records that fit the criteria of 30. If I put a button on the form to do a requery and press the button, all the records...
4
5521
by: Daniel R. Rossnagel | last post by:
As I can hide the bar of I title of a window daughter maximized within form MDI Already I have proven with different types from borders, hiding thebuttons to maximize, to diminish and control box, but nothing... If somebody can help me I'm thanked Daniel R. Rossnagel
3
1030
by: TyBreaker | last post by:
I have a form where when you click on a button a new form appears. However the controls on the new form appear as blanked out regions on the form until I click on them and suddenly they appear. I haven't seen this before but am a bit of a newbie with VB 2005 so does anybody know why this is happening? -- ______ ___ __ /_ __/_ __/ _ )_______ ___ _/ /_____ ____ / / / // / _ / __/ -_) _ `/ '_/ -_) __/ /_/ \_,...
9
12841
by: mohit.akl | last post by:
Hey guys & gals I am havng trouble modifying the control box. I want to make the maximise button invisible and have minimisise button instead of it. Like this _ X (not like _ o X ) How to do this... and eventually i want to modify the control box in the form of ? _ X ... I.e. adding a new button to control box. I need to detect the click events.
12
3511
deephill
by: deephill | last post by:
hi i need form dependency. Can u check below code? <p>1. Are you married?</p> <p>
11
5287
by: Zytan | last post by:
I have created a new form from the main form. When I close the main form with the 'x' close button, its Form.FormClosed event is run, but not the dialog's. Is this normal? It is ok / dangerous? How can I force shutdown code within the dialog's Form.FormClosed event run? Zytan
12
2361
by: Rob | last post by:
Let's say you open Form1 that contains TabControl1 There are several tabs on TabControl1 Now you open a new Form2 that contains a User Control How can you determine the Selected tab in Form1 from the User Control in Form2 ? Hope this is clear enough...
2
3598
by: Susan Bricker | last post by:
Hi. I am stumped. I have a form that when opened via logic (VBA OpenForm) the screen appears to flash but the form does not appear. I've traced and it certainly goes to the form's module and the Form_Open and Form_Load routines...but it doesn't appear. I've looked around at the attributes of the form, at the attributes of the other forms opened in the background but I can't figure it out. I even went so far as to force the other...
0
8476
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8393
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8820
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8598
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8670
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6223
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5695
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.