Solved

language msgbox

Posted on 2006-10-30
8
242 Views
Last Modified: 2010-04-23
how do i set a messagebox depending on the user's language ?

I want to use a Y/N msgbox in french



thank you.
0
Comment
Question by:TheSonics
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
8 Comments
 
LVL 17

Expert Comment

by:ZeonFlash
ID: 17837022
I don't believe that you can control that on the msgbox's.  The language that is displayed is pulled from the system language, so you would have to have your entire system set to display the French language.  Is this the only place in your application that you wish to use a different language?  You might want to also consider just creating your own CustomMsgBox class that you can use in place of the built-in MsgBox.
0
 

Author Comment

by:TheSonics
ID: 17837029
sounsd good i have to derivate a class or do my own form ?
0
 
LVL 17

Accepted Solution

by:
ZeonFlash earned 250 total points
ID: 17837219
You can just create your own form.  You can pass in the message text (and even the button type/text, if you want to extend the form's usage).  Something like this:

Public Class CustomMsgBox
      Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

      Public Sub New(ByVal MessageString As String)
            MyBase.New()

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

            'Add any initialization after the InitializeComponent() call
            lblMessage.Text = MessageString
      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 lblMessage As System.Windows.Forms.Label
      Friend WithEvents btnYes As System.Windows.Forms.Button
      Friend WithEvents btnNo As System.Windows.Forms.Button
      <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
            Me.lblMessage = New System.Windows.Forms.Label
            Me.btnYes = New System.Windows.Forms.Button
            Me.btnNo = New System.Windows.Forms.Button
            Me.SuspendLayout()
            '
            'lblMessage
            '
            Me.lblMessage.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                              Or System.Windows.Forms.AnchorStyles.Left) _
                              Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            Me.lblMessage.Location = New System.Drawing.Point(32, 30)
            Me.lblMessage.Name = "lblMessage"
            Me.lblMessage.Size = New System.Drawing.Size(308, 38)
            Me.lblMessage.TabIndex = 0
            Me.lblMessage.Text = "Label1"
            '
            'btnYes
            '
            Me.btnYes.Location = New System.Drawing.Point(112, 84)
            Me.btnYes.Name = "btnYes"
            Me.btnYes.TabIndex = 1
            Me.btnYes.Text = "Button1"
            '
            'btnNo
            '
            Me.btnNo.Location = New System.Drawing.Point(194, 84)
            Me.btnNo.Name = "btnNo"
            Me.btnNo.TabIndex = 2
            Me.btnNo.Text = "Button2"
            '
            'CustomMsgBox
            '
            Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
            Me.ClientSize = New System.Drawing.Size(364, 131)
            Me.Controls.Add(Me.btnNo)
            Me.Controls.Add(Me.btnYes)
            Me.Controls.Add(Me.lblMessage)
            Me.Name = "CustomMsgBox"
            Me.Text = "Form1"
            Me.ResumeLayout(False)

      End Sub

#End Region

      Private Sub btnYes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnYes.Click
            Me.DialogResult = DialogResult.Yes
            Me.Hide()
      End Sub

      Private Sub btnNo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNo.Click
            Me.DialogResult = DialogResult.No
            Me.Hide()
      End Sub
End Class


Then you can call it by using something like this:

      Dim msg As New CustomMsgBox("This is the message.  Please press Yes or No.")
      Dim result As MsgBoxResult

      msg.btnYes.Text = "Yes"
      msg.btnNo.Text = "No"
      result = msg.ShowDialog()

      MsgBox("The result was: " & result.ToString)
0
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 250 total points
ID: 17838747
if you only want to translate the buttons, see http://www.codeproject.com/Purgatory/messageboxhook.asp

alson have a look at an article I wrote in January 2006 from http://emoreau.s2i.com/
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 18033213
you should split points between ZeonFlash and me.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question