473,394 Members | 1,845 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Dialog Box Centering

17
I am running a validation function and i call a msgbox at the end to let the user know their information was valid.
The problem is that the words are left justified, besides adding spaces to the front of the msg box is there a better way to center the text?



Expand|Select|Wrap|Line Numbers
  1. Public Function ValidatePW(password As String, Username As String, DomainName As String) As Boolean
  2. ' Start by retrieving the user's name
  3. Dim lpBuffer As String, nSize As Long
  4. Dim rv As Long, usrName As String
  5. Dim hToken As Long
  6.  
  7. ' Initialise an empty buffer, 10 characters long (long enough for most user names)
  8. lpBuffer = String(10, Chr(0))
  9. Do
  10.     nSize = Len(lpBuffer)
  11.     rv = Getusername(lpBuffer, nSize)
  12.     If rv = 0 Then
  13.         ' The function probably failed due to the buffer being too small
  14.         ' nSize holds the required size
  15.         lpBuffer = String(nSize, Chr(0)) ' Resize buffer to accomodate big name
  16.     End If
  17. Loop Until rv <> 0
  18. ' Extract user name from buffer
  19. usrName = Left(lpBuffer, nSize - 1)
  20.  
  21. If usrName <> Username Then
  22.  
  23.     MsgBox "Unable to login your user name is incorrect"
  24.  
  25.     Exit Function
  26.  
  27. End If
  28.  
  29. If Domain() <> DomainName Then
  30.  
  31.  
  32.     MsgBox "Unable to login your user Domain name is incorrect"
  33.  
  34.     Exit Function
  35.  
  36. End If
  37.  
  38. ' Now validate the password
  39. rv = LogonUser(usrName, vbNullString, password, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, hToken)
  40. If rv <> 0 Then
  41.     ' Password validated successfully
  42.     MsgBox "Your Password is valid"
  43.     DoCmd.Close acForm, "frmLogin", acSaveNo
  44.     DoCmd.OpenForm "frmRiskSwitch", acNormal
  45. Else
  46.     ' Username and password failed validation
  47.     MsgBox "Your Password is Invalid"
  48. End If
  49. End Function
  50.  
Oct 13 '08 #1
2 1825
Stewart Ross
2,545 Expert Mod 2GB
Not using a message box as such, no. You cannot customise the justification of a messagebox.

If you need centred text your best bet is to design a custom pop-up message form in which your message is written to an Access textbox.

Text displayed in textboxes can be set to left, centre or right aligned directly, removing the need to add spaces to the text.

-Stewart
Oct 13 '08 #2
ckrows
17
Thanks for the info!
Oct 13 '08 #3

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

Similar topics

1
by: sjsmith3 | last post by:
Is there a way to center a dialog on a screen? -------------------------------------------------------------------- mail2web - Check your email from the web at http://mail2web.com/ .
11
by: Jeff Thies | last post by:
I have a series of blocks that are float left that I need centered on the page. <div class="center" align="center"> <div style="width: 100 px;float: left">thumbnail 1</div> <div style="width:...
15
by: red | last post by:
How do I center two side by side divs ? I've been writing css pages for a while but there's one thing tha still eludes me. I can center a div with margin auto. I can place two divs side by side...
6
by: Axel Siebenwirth | last post by:
Hi, as described at http://www.quirksmode.org/css/centering.html, I try to do to centering with my site. I did exactly as told on that page but it only seems to center horizontally. My site...
2
by: Harry Whitehouse | last post by:
My print status dialog is appearing outside of the context of my application. How can I center this dialog on the parent? Also, is there a way to modify the information shown on the print status...
0
by: Harry Whitehouse | last post by:
I misposted this quesiton earlier in this newsgroup. The print dialog in my application (the one where you select a printer) can be centered on the parent form without much trouble. But can one...
7
by: Peter | last post by:
I have a primary form named frmMain. During some extended data pulls I launch another Dialog Form named frmUpdating. How do I keep the frmUpdating centered on the frmMain if a user moves the...
3
by: John Pote | last post by:
1. Horizontal centering a <divin browser window. The current trend seems to be to place page content in a fixed width area in the middle of the browser window. How is this achieved? If I use a...
5
by: Markus Ernst | last post by:
Hello This is a test example: http://www.markusernst.ch/anthracite/ http://www.markusernst.ch/anthracite/living_divani.html After googling and experimenting for several hours, I ended up...
1
by: =?Utf-8?B?ZnJhbmt5?= | last post by:
Hello, I've created a table that has two rows that are span across three columns. The third row has three columns, each with an image. The last row is also span accross three columns. The span...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.