Results 1 to 8 of 8

Thread: [RESOLVED][02/03] How to make the focus on activated form only

  1. #1

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    [RESOLVED][02/03] How to make the focus on activated form only

    Hi All ,

    I describe clearly within the content of thread, Hope u all understand my problem because my english is bad.

    When user open a form within the program, the user only can do action on activated form except others program. Seem like the address book in Windows XP. When u click new contact, u must completely fill up the form before u go back to parent form unless u close it without modification.

    Thanks for help me :-)
    Last edited by nUflAvOrS; Aug 14th, 2007 at 08:37 PM. Reason: RESOLVED
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  2. #2
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Lancashire UK
    Posts
    375

    Re: [02/03] How to make the focus on activated form only

    Use 'ShowDialog' to show your new form, that way focus will remain on the new form until it's closed
    If my post helps , please feel free to rate it

  3. #3

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: [02/03] How to make the focus on activated form only

    Thanks your help !!

    However, when i used showdialog(), that is not exactly i want because when i activate the childform with showdialog instead of .show, the form do not belong to childform anymore.

    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [02/03] How to make the focus on activated form only

    Are you saying (without actually saying it) that you want this second form to be an MDI child of the first? If so then what you're asking for is not possible. You cannot prevent access to the parent because the child form is actually a child control of the parent. You can prevent access to the other controls without preventing access to the child form too, unless you individually disable each of the other controls.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,051

    Re: [02/03] How to make the focus on activated form only

    Do something like validate all of the entries.
    If not of all of the entries are acceptable, cancel the form closing event and ask the user if they want to abort the entries entirely or just continue with making corrections to the entries.

  6. #6

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: [02/03] How to make the focus on activated form only

    Thanks ya ...


    Code:
    If Not IsNothing(frmadd) Then
                If Not frmadd.IsDisposed Then
                    frmadd.BringToFront()
                Else
                    frmadd = New frmAdd
                    frmadd.lblForm.Text = "Add New Machine Type"
                    frmadd.lvlItem.Columns.Add("Machine Type", frmadd.lvlItem.Width - 10, HorizontalAlignment.Left)
                    frmadd.ShowDialog()
                    frmadd.BringToFront()
    
                End If
            Else
                frmadd = New frmAdd
                frmadd.lblForm.Text = "Add New Machine Type"
                frmadd.lvlItem.Columns.Add("Machine Type", frmadd.lvlItem.Width - 10, HorizontalAlignment.Left)
                frmadd.ShowDialog()
                frmadd.BringToFront()
    
    
    End If
    frmadd.MdiParent = Me.MdiParent
    frmadd.Dock = DockStyle.Top
    Name:  Screen Capture.JPG
Views: 161
Size:  94.0 KB

    The area i mark with circle show that when i open a new Childform.by using .showdialog() it is the way i want, the problem is it will open up a new icon in window panel.However, it would not create a new icon in window panel by using .show() method but it is not the way i want.




    hmm~~ Sorry, how to stop the form_closing event ?
    Last edited by nUflAvOrS; Aug 14th, 2007 at 08:08 PM.
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [02/03] How to make the focus on activated form only

    Just set the form's ShowInTaskbar property to False, which is what you should be doing for all modal dialogues.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: [02/03] How to make the focus on activated form only

    Opsss ! thanks Jmcilhinney .. U r kind ....hahah ..

    Thanks others ppl opinion.. thanks a lot..

    I appreciate the help from you all :-)
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width