Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6929507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:19:36+00:00 2026-05-27T11:19:36+00:00

With the Top and Left arguments for this function is there a Centre screen

  • 0

With the Top and Left arguments for this function is there a Centre screen option, or will it always be a number?

I’m using this instead of a regular inputbox as it handles the cancel event better but it always appears in the bottom right of the screen which is less than helpful :/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:19:37+00:00Added an answer on May 27, 2026 at 11:19 am

    You can test the regular inputbox to see if cancel was pressed, and it has the extra benifit of always being centered. Just use StrPtr(variable) = 0 to test it. Simple!

    Another way to avoid a user hitting OK with nothing typed is to add a default value inside the input box to start with, that way you know that if it returns an empty string, it’s most likely due to the cancel button being pressed.

    StrPtr will return a 0 if cancel was selected (also returns 0 for vbNullString, btw). Please note that StrPtr work in VB5, VB6, and VBA, but since it’s not officially supported, it could be rendered unusuable years down the line. I highly doubt they’d get rid of it but it’s worth considering if this is an application you plan to distribute.

    Sub CancelTest()
    
    Dim temp As String
    
    temp = InputBox("Enter your name", "Cancel Test")
    If StrPtr(temp) = 0 Then
        ' You pressed cancel
    Else
        If temp = "" Then
            'You pressed OK but entered nothing
        Else
            'Do your thing
        End If
    End If
    
    End Sub
    

    Some more info on strptr:
    StrPtr(S) returns a pointer to the actual string data currently stored in S. This is what you need when passing the string to Unicode API calls. The pointer you get points to the Datastring field, not the Length prefix field. In COM terminology, StrPtr returns the value of the BSTR pointer. (from the fantastic site: http://www.aivosto.com/vbtips/stringopt2.html)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm calling a function like this: myfunc($tab, {'top-left', 'bottom-left'}, defaults.tabRounded); The function definition is:
Anyone have code to set margins(top,left,right,bottom) using excel interop and vb.net. I think it
In my application - there are four buttons named as follows: Top - left
How do I get JLabel location instead of top left x/y location of the
I have a function: var myAnimation = function(){ $(.next_action).css({'bottom':-100%,left:0}).animate({'bottom':0},1000); $('.active').animate({'top':-100%},1000); } that takes two
How does the logo in the top left corner of the screen gradually change
How to get top left corner of tag not using JQuery?
Notification and NotificationManager are used to create icons to be placed on the top-left
Is it possible to retrieve the geometric position (i.e. top/left offsets from either the
Suppose I have a span: <span class=myspan></span> .myspan{ background: url(image.png) top left no-repeat; }

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.