Msg Box not displaying messages

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • moumita

    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.
    InitializeCompo nent()

    'Add any initialization after the InitializeCompo nent() 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.Disp ose()
    End If
    End If
    MyBase.Dispose( disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.Componen tModel.IContain er

    '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.Diagnos tics.DebuggerSt epThrough()> Private Sub
    InitializeCompo nent()
    Me.Label1 = New System.Windows. Forms.Label
    Me.TextBox1 = New System.Windows. Forms.TextBox
    Me.Button1 = New System.Windows. Forms.Button
    Me.SuspendLayou t()
    '
    'Label1
    '
    Me.Label1.Font = New System.Drawing. Font("Microsoft Sans
    Serif", 14.0!, System.Drawing. FontStyle.Bold,
    System.Drawing. GraphicsUnit.Po int, CType(0, Byte))
    Me.Label1.Locat ion = New System.Drawing. Point(16, 16)
    Me.Label1.Name = "Label1"
    Me.Label1.Size = New System.Drawing. Size(256, 24)
    Me.Label1.TabIn dex = 0
    Me.Label1.Text = "Guessing Game"
    Me.Label1.TextA lign =
    System.Drawing. ContentAlignmen t.MiddleCenter
    '
    'TextBox1
    '
    Me.TextBox1.Loc ation = New System.Drawing. Point(16, 64)
    Me.TextBox1.Nam e = "TextBox1"
    Me.TextBox1.Siz e = New System.Drawing. Size(256, 20)
    Me.TextBox1.Tab Index = 1
    Me.TextBox1.Tex t = ""
    '
    'Button1
    '
    Me.Button1.Loca tion = New System.Drawing. Point(80, 112)
    Me.Button1.Name = "Button1"
    Me.Button1.Size = New System.Drawing. Size(120, 24)
    Me.Button1.TabI ndex = 2
    Me.Button1.Text = "GUESS"
    '
    'Form1
    '
    Me.AutoScaleBas eSize = 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(B yVal sender As System.Object, ByVal e As
    System.EventArg s) Handles Button1.Click
    'make sure the TextBox contains a number
    If IsNumeric(TextB ox1.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.Te xt) < 1 Or Val(TextBox1.Te xt) > 10 Then
    MsgBox("Please enter a number between 1 and 10!")
    Exit Sub
    End If

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



    End Sub

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

  • Kerry Moorman

    #2
    RE: Msg Box not displaying messages

    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:
    [color=blue]
    > 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.
    > InitializeCompo nent()
    >
    > 'Add any initialization after the InitializeCompo nent() 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.Disp ose()
    > End If
    > End If
    > MyBase.Dispose( disposing)
    > End Sub
    >
    > 'Required by the Windows Form Designer
    > Private components As System.Componen tModel.IContain er
    >
    > '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.Diagnos tics.DebuggerSt epThrough()> Private Sub
    > InitializeCompo nent()
    > Me.Label1 = New System.Windows. Forms.Label
    > Me.TextBox1 = New System.Windows. Forms.TextBox
    > Me.Button1 = New System.Windows. Forms.Button
    > Me.SuspendLayou t()
    > '
    > 'Label1
    > '
    > Me.Label1.Font = New System.Drawing. Font("Microsoft Sans
    > Serif", 14.0!, System.Drawing. FontStyle.Bold,
    > System.Drawing. GraphicsUnit.Po int, CType(0, Byte))
    > Me.Label1.Locat ion = New System.Drawing. Point(16, 16)
    > Me.Label1.Name = "Label1"
    > Me.Label1.Size = New System.Drawing. Size(256, 24)
    > Me.Label1.TabIn dex = 0
    > Me.Label1.Text = "Guessing Game"
    > Me.Label1.TextA lign =
    > System.Drawing. ContentAlignmen t.MiddleCenter
    > '
    > 'TextBox1
    > '
    > Me.TextBox1.Loc ation = New System.Drawing. Point(16, 64)
    > Me.TextBox1.Nam e = "TextBox1"
    > Me.TextBox1.Siz e = New System.Drawing. Size(256, 20)
    > Me.TextBox1.Tab Index = 1
    > Me.TextBox1.Tex t = ""
    > '
    > 'Button1
    > '
    > Me.Button1.Loca tion = New System.Drawing. Point(80, 112)
    > Me.Button1.Name = "Button1"
    > Me.Button1.Size = New System.Drawing. Size(120, 24)
    > Me.Button1.TabI ndex = 2
    > Me.Button1.Text = "GUESS"
    > '
    > 'Form1
    > '
    > Me.AutoScaleBas eSize = 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(B yVal sender As System.Object, ByVal e As
    > System.EventArg s) Handles Button1.Click
    > 'make sure the TextBox contains a number
    > If IsNumeric(TextB ox1.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.Te xt) < 1 Or Val(TextBox1.Te xt) > 10 Then
    > MsgBox("Please enter a number between 1 and 10!")
    > Exit Sub
    > End If
    >
    > 'check for high answer
    > If Val(TextBox1.Te xt) > num Then
    > MsgBox("That number is too high")
    > ElseIf Val(TextBox1.Te xt) < num Then
    > MsgBox("That number is too low")
    > Else
    > MsgBox("That number is CORRECT!")
    > End
    > End If
    >
    >
    >
    > End Sub
    >
    > Private Sub Form1_Load(ByVa l sender As Object, ByVal e As
    > System.EventArg s) Handles MyBase.Load
    > Randomize()
    > num = Int((Rnd() * 6) + 1)
    > End Sub
    > End Class
    >
    >[/color]

    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: Msg Box not displaying messages

      "moumita" <moumita11@gmai l.com> schrieb:[color=blue]
      >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 ???[/color]

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

      --
      M S Herfried K. Wagner
      M V P <URL:http://dotnet.mvps.org/>
      V B <URL:http://classicvb.org/petition/>

      Comment

      Working...