473,511 Members | 10,041 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 1174
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.nameTextBox.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
6072
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...
1
1607
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...
3
4969
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...
4
5514
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,...
3
1022
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...
9
12824
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...
12
3501
deephill
by: deephill | last post by:
hi i need form dependency. Can u check below code? <p>1. Are you married?</p> <p>
11
5259
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 /...
12
2341
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...
2
3592
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...
0
7148
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
7430
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...
1
7089
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...
0
7517
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...
0
5673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5072
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...
0
4743
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...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
451
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.