Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 19th, 2007, 08:15 PM
Friend of Wrox
 
Join Date: Feb 2007
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default MsgBox issues

 Hi, apologies if this thread has been discussed before.

I have done VB before but not for a while, i have created an ASP login page but if the login is invalid then i wish to create a popup saying its incorrect with an ok only.

 the code i have used is:

MsgBox("Incorrect username or password please try again",0,"Incorrect Login")

so you understand the background -

i have an if statement where if the login is correct then the user is redirected and if it is invalid then the user is redirected back to the login page but i would like a popup of some sort explaining the incorrect details.

am i going about this the right way?

thanks

 
Old February 19th, 2007, 08:42 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

You cant use MsgBox in VBScript as that spawns a system message box and since the VBScript is executed on the server not the client if it were possible to use the MsgBox command, it would open a message box on the server, not the client.

Instead do something like this:

Dim sJavaScript
sJavaScript = "<script language=javascript>"
sJavaScript = sJavaScript & "alert('Invalid username and password!');"
sJavaScript = sJavaScript & "</scr" & "ipt>"

Response.write(sJavaScript)

That will spawn a javascript alert box on the client.

For asp type questions, you would be best off staying in the ASP forums where you were earlier, this is more or less for VB (Windows apps) and such.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429
 
Old February 20th, 2007, 02:47 AM
Friend of Wrox
 
Join Date: Feb 2007
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default

i see, i guess it was blind faith hoping vb woukd work!






Similar Threads
Thread Thread Starter Forum Replies Last Post
connection string issues, web.config file issues kaliaparijat ASP.NET 2.0 Professional 1 June 12th, 2008 08:07 AM
Msgbox Help darrenb Access VBA 2 June 8th, 2007 12:53 AM
MsgBox prabodh_mishra Pro VB 6 1 December 29th, 2006 11:51 AM
help with Msgbox helmekki Excel VBA 2 June 25th, 2004 08:24 AM
msgbox bph Access VBA 2 February 6th, 2004 03:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.