473,385 Members | 1,872 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,385 software developers and data experts.

Msg Box not displaying messages

I have the folowing code..the logic according to me is correct..but I
dont know...the msg boxes are not displaying anything...am I supposed
to change any settings ???


Public Class Form1
Inherits System.Windows.Forms.Form
'declare the number variable
Dim num As Integer
#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans
Serif", 14.0!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(16, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(256, 24)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Guessing Game"
Me.Label1.TextAlign =
System.Drawing.ContentAlignment.MiddleCenter
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(16, 64)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(256, 20)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(80, 112)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(120, 24)
Me.Button1.TabIndex = 2
Me.Button1.Text = "GUESS"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
'make sure the TextBox contains a number
If IsNumeric(TextBox1.Text) = False Then
MsgBox("Please enter a number between 1 and 10!")
Exit Sub
End If

'make sure the number is between 1 and 10
If Val(TextBox1.Text) < 1 Or Val(TextBox1.Text) > 10 Then
MsgBox("Please enter a number between 1 and 10!")
Exit Sub
End If

'check for high answer
If Val(TextBox1.Text) > num Then
MsgBox("That number is too high")
ElseIf Val(TextBox1.Text) < num Then
MsgBox("That number is too low")
Else
MsgBox("That number is CORRECT!")
End
End If

End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Randomize()
num = Int((Rnd() * 6) + 1)
End Sub
End Class

Feb 10 '06 #1
2 1241
moumita,

If you mean that the message boxes are appearing but do not contain any
text, then are you running McAfee Enterprise virus software?

If so, then there is a patch for this problem at McAfee's web site.

Kerry Moorman
"moumita" wrote:
I have the folowing code..the logic according to me is correct..but I
dont know...the msg boxes are not displaying anything...am I supposed
to change any settings ???


Public Class Form1
Inherits System.Windows.Forms.Form
'declare the number variable
Dim num As Integer
#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans
Serif", 14.0!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(16, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(256, 24)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Guessing Game"
Me.Label1.TextAlign =
System.Drawing.ContentAlignment.MiddleCenter
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(16, 64)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(256, 20)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(80, 112)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(120, 24)
Me.Button1.TabIndex = 2
Me.Button1.Text = "GUESS"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
'make sure the TextBox contains a number
If IsNumeric(TextBox1.Text) = False Then
MsgBox("Please enter a number between 1 and 10!")
Exit Sub
End If

'make sure the number is between 1 and 10
If Val(TextBox1.Text) < 1 Or Val(TextBox1.Text) > 10 Then
MsgBox("Please enter a number between 1 and 10!")
Exit Sub
End If

'check for high answer
If Val(TextBox1.Text) > num Then
MsgBox("That number is too high")
ElseIf Val(TextBox1.Text) < num Then
MsgBox("That number is too low")
Else
MsgBox("That number is CORRECT!")
End
End If

End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Randomize()
num = Int((Rnd() * 6) + 1)
End Sub
End Class

Feb 10 '06 #2
"moumita" <mo*******@gmail.com> schrieb:
I have the folowing code..the logic according to me is correct..but I
dont know...the msg boxes are not displaying anything...am I supposed
to change any settings ???


Fixing the problem of missing text in controls and messageboxes
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=controlsmissingtextbug&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Feb 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Gregory | last post by:
Hello, I've managed to build two web pages, one that can display images with associated text data in a table, and one that can resize and display images without the text. I'd like to resize the...
5
by: TG | last post by:
Dear PHP Group, I have two forms that are used to collect user information. The first one takes user inputted values such as fullname, city, address etc. I want these values to display in the...
2
by: John Alleyman | last post by:
Hi there, Is there a simple way to prevent error messages (falsely connecting to database etc.) being diplayed? My own build in messages are enough... thanks, Chris
1
by: Alan Chen | last post by:
Hi, For a server with GUI, I am using a listview to display an online server status like this: Client IP Request # Status 1.1.1.1 1 success 2.2.2.2 2 ...
5
by: Helen | last post by:
Hi I'm using ASP.NET's standard validators to display error messages when people don't fill in required fields on my form. The error messages currently show as soon as the form is loaded, but...
2
by: Irfan Akram | last post by:
Hi Guys, I was wondering if you can help me with this question. I am trying to display warning messages on my web-page, prompting the user to check his action, and confirm what the current...
1
by: royzeb | last post by:
Hi, I've got a simple vc++ program that basically just runs a daemon in the background and sends update messages to a logfile as it goes along. What I'd like to do is see these log messages also...
20
by: Tim Reynolds | last post by:
Team, I am developing a web service. In testing in on my enw PC, I am expecting to see exceptions thrown appear on my browser. Instead I am getting an HTTP 500 Internal Server Error page and I am...
7
by: swethasivaram | last post by:
Hello I have a Java-based web application whose interface can be in multiple languages. My requirement is that the javascript alerts that I display should be displayed in the language in which...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.