CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2002
    Location
    Israel
    Posts
    396

    TopMost and inputbox

    Hi lets say i have a big form that i set it to be TopMost=true.
    Now i want to call inputbox after a click on a button on my form.
    the inputbox will not be shown cuz the form is on top of it.
    How can i make the inputbox to be top most as well so i will be able to see it over the main form?
    Thanks

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: TopMost and inputbox

    A quick fix would be to send your form to the back temporarily, have a look at this :
    Code:
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Me.SendToBack()
            Dim StrInput As String = InputBox("Enter Your Name", "Enter Name")
            Me.Text = StrInput
        End Sub
    Once run, the form will move to the back, and the Inputbox will move to the front. Just remember to bring your form to the front again, once your finsihed You can use Me.TopMost = True
    Last edited by HanneSThEGreaT; May 30th, 2007 at 03:32 AM.

  3. #3
    Join Date
    Sep 2002
    Location
    Israel
    Posts
    396

    Re: TopMost and inputbox

    Thanks HanneSThEGreaT,
    but this solution will not work for me.
    My project is build this way:
    Form (Top Most)
    ChildForm(Top Most)
    UserControl ActiveX in the Child form that call the inputbox.

    I try and it still been hidden under the forms.
    I guess i will have to create my own inputbox and set it TopMost flag to the parent TopMost flag.
    I just hoped that there is a simple way to do that and to avoid the "longer" way.

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: TopMost and inputbox

    This :
    Quote Originally Posted by leeshadmi
    My project is build this way:
    Form (Top Most)
    ChildForm(Top Most)
    UserControl ActiveX in the Child form that call the inputbox.
    was quite important information to include with your first post, agree ¿
    Please ensure to always give the relevant details of your perticular problems. Help us help you!

  5. #5
    Join Date
    Sep 2002
    Location
    Israel
    Posts
    396

    Re: TopMost and inputbox

    Right!
    Sorry.

  6. #6
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: TopMost and inputbox

    You can actually set The TopLevel Properties of the Forms to False before showing the InputBox and then again change that to True after the inputbox is closed.

    The better way would be to have your own Form as InputBox.

  7. #7
    Join Date
    May 2022
    Location
    I'm from Uzbekistan
    Posts
    1

    Re: TopMost and inputbox

    I have problems same to yours,please help for me to do anything

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: TopMost and inputbox

    Quote Originally Posted by xoqon2003 View Post
    I have problems same to yours,please help for me to do anything
    Did you try the "similar" solutions as suggested in the post#2 and post#6?
    Victor Nijegorodov

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

Featured