Wrox Programmer Forums
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics 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 April 28th, 2005, 12:02 PM
Registered User
 
Join Date: Apr 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default message boxes

I am not able to have MessageBox.Show display correctly. The most simple messagebox command will show me the box without displaying the text or button text but a caption and icon are correct. I would appreciate any suggestions.

 
Old April 28th, 2005, 01:11 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Why type of application are you trying this in? WinForms or WebForms?
 
Old April 28th, 2005, 01:21 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Please post the statement that is obtaining the results you describe.
 
Old April 28th, 2005, 03:25 PM
Registered User
 
Join Date: Apr 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It's VB.NET.


#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.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 273)
        Me.Name = "Form1"

    End Sub

#End Region

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MessageBox.Show("My Text", "My Caption", MessageBoxButtons.OKCancel, _
        MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)
    End Sub
End Class


 
Old April 28th, 2005, 08:36 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

I copied your code to a new project and I had no problem showing everything. Try creating a new project and adding your code to it to see if you get the same thing.

J
 
Old April 29th, 2005, 09:56 AM
Registered User
 
Join Date: Apr 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried a new project and inserted the code as suggested. Still have the same results - a box pops up with 2 blank buttons, no text but Caption and the icon show.

 
Old April 29th, 2005, 10:04 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

If you are going to show a set of buttons, and you want to take specific action chosen by the specific button clicked, you must receive infromation on which button was clicked. I doubt this is the problem, but often it is helpful to eliminate the obvious... Try
Code:
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim b As Boolean

        b = MessageBox.Show("My Text", "My Caption", _
                            MessageBoxButtons.OKCancel, _
                            MessageBoxIcon.Information, _
                            MessageBoxDefaultButton.Button1)
    End Sub
 
Old May 2nd, 2005, 05:52 AM
Registered User
 
Join Date: Apr 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Brian,
Your suggestion did not work either.
Thanks.

 
Old May 2nd, 2005, 07:07 AM
Authorized User
 
Join Date: Oct 2004
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It worked for me as well.

Rule number one when some code does not work, try and make it simpler!!

How about using the most basic implementation:

MessageBox.Show("Hello world")
 
Old May 2nd, 2005, 09:01 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Maybe you have a problem somewhere in your installation of VS.Net. Have you tried uninstalling it and reinstalling it?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Message Boxes and passwords jackdaddy Javascript How-To 5 November 27th, 2004 11:24 PM
Formatting Message Boxes Magic_Hat Excel VBA 1 June 21st, 2004 10:13 AM
Customizing Javascript Message boxes pvasudevan Javascript How-To 1 April 19th, 2004 10:19 AM
How to I create non-modal message boxes? Ciarano VB How-To 0 March 12th, 2004 12:01 PM





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