Click here to Skip to main content
15,894,405 members
Articles / Desktop Programming / Windows Forms

MessageBox Translation Hook

Rate me:
Please Sign up or sign in to vote.
2.26/5 (12 votes)
18 Nov 2004 71.7K   2.8K   23  
With this class (sample) you can translate system MessageBox to any language. HOOK
Option Explicit On 
Option Strict On

Public Class Form1
    Inherits System.Windows.Forms.Form

#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(312, 243)
        Me.Name = "Form1"
        Me.Text = "Form1"

    End Sub

#End Region

    Private Sub Form1_Load( _
                    ByVal sender As System.Object, _
                    ByVal e As System.EventArgs) Handles MyBase.Load

        CMessageBox.Show("Test string", "Title", MessageBoxButtons.OK, MessageBoxIcon.Information)
        CMessageBox.Show("Test string", "Title", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)
        CMessageBox.Show("Test string", "Title", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
        CMessageBox.Show("Test string", "Title", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning)
        CMessageBox.Show("Test string", "Title", MessageBoxButtons.RetryCancel, MessageBoxIcon.Stop)
        CMessageBox.Show("Test string", "Title", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Asterisk)

    End Sub

End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Croatia Croatia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions