Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

language msgbox

Posted on 2006-10-30
8
Medium Priority
?
256 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 1000 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 1000 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

Independent Software Vendors: 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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

610 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