473,396 Members | 2,129 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,396 software developers and data experts.

displaying a messagebox.

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11.  
  12. public partial class _Default : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.  
  17.     }
  18.     protected void Button1_Click(object sender, EventArgs e)
  19.     {
  20.         if ((TextBox1.Text == "gopal") && (TextBox2.Text == "smile"))
  21.         {
  22.             Response.Redirect("Default2.aspx");
  23.         }
  24.         else
  25.         {
  26.             MessageBox.Show("Invalid Username and Password combination");
  27.         }
  28.     }
  29. }
this messagebox gives an error that messagebox does not found in current context.
Sep 14 '10 #1
3 2945
Plater
7,872 Expert 4TB
Be sure to add the namespace reference to classes you use:
using System.Windows.Forms;

EDIT: Oops this is a webpage? That messagebox will popup on the server, not on the client.
Backend code is only executed on the server.

You would need to use the javascript alert() function to popup a message on the client
Sep 14 '10 #2
i m using VBScript as a scripting language.
after using namespace System.Windows.Forms; it gives an error that the namespace name 'Windows' does not exists in the namespace 'System'(are you missing an assembly refrence?).
Sep 15 '10 #3
mzmishra
390 Expert 256MB
try something like this

string script =" MsgBox 'Invalid Username and Password combination'";
Page.RegisterStartupScript("message", "<script language=\"VBScript\">" + script + "</script>");
Sep 15 '10 #4

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

Similar topics

7
by: Bil Muh | last post by:
Esteemede Developers, I would like to Thank All of You in advance for your sincere guidances. I am developing a software using Visual C++ .NET Standard Edition with Windows Form (.NET)...
11
by: Rich Tasker | last post by:
I have a strange situation. A simple call to MessageBox.Show("XXX", "YYY") does not display the message in the messagebox with a visible font. Based on the content of the messagebox, the box...
3
by: Cybertof | last post by:
Hello, I have a strange behavior. On a MyForm form, i have a button with this code ----> MessageBox.Show("hello"); When i start the project with this single form ----> Application.Run(new...
7
by: Bill | last post by:
For some reason, I have an errormessage popup that "blinks", but pops up BEHIND the applications, which is confusing to users. Is there any way to force it to the top?
1
by: kannan | last post by:
hi, It might be the simple question. I am concatinating two string and displaying in messagebox. Ex: MessageBox.show(string.Concat("The following validation(s) failed:\n", arg.DisplayMessage))...
20
by: Peter E. Granger | last post by:
I'm having a strange problem (or at least it seems strange to me) trying to display a MessageBox in a VC++ .NET forms application. If I put the call to MessageBox::Show in the form's .h file, it...
4
by: Larry Woods | last post by:
I have a Messagebox that looks like: MessageBox.Show("There are pending changes for this patient. Do you want to continue to close?", "Pending Changes", MessageBoxButtons.YesNo,...
10
by: Ed Bitzer | last post by:
One option of the messagebox object indicates it can be placed over a selected window rather than just appearing centered on the desktop. The function is "Overloads Public Shared Function...
2
by: condolesaP | last post by:
Hello everyone, I m customozing AutoCAD using VC++ I want to display a messageBox in AutoCAD window can anybody please help me through it
6
by: garyusenet | last post by:
Hi i have a messagebox like so. MessageBox.Show(mystring); I would like to highlight each occurance of the word "and" in the messagebox. How do I tell the messagebox to highlight each...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.