Click here to Skip to main content
12,816,654 members (36,417 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#
I am trying to update vb6 code into c#. I have vb6 code like this
 If MsgBox("Adjust transfer volume from " & m_objTransfer.TransferVolume & " cc to " & m_dblTempVolFromTo & " cc ?", vbYesNo) = vbYes Then
            txtTransferTransferVolume.Text = m_dblTempVolFromTo
        End If

I have tried to convert this code into c# using some tool, the code is like this.
if ((MessageBox.Show(("Adjust transfer volume from " 
                          + (m_objTransfer.TransferVolume + (" cc to " 
                          + (m_dblTempVolFromTo + " cc ?")))), vbYesNo) == System.Windows.Forms.MessageBoxButtons.Yes)) 

The concept is it has to show the above message and ask yes or no. here "vbYesNo" is not avalible in c#. how can i implement the same concept in c#.

Help me please.
Posted 22-Feb-13 4:15am
Updated 22-Feb-13 4:16am
Chris Reynolds (UK) 22-Feb-13 9:20am
Are you getting an error? If so, what is it?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You could try something like this;

if (MessageBox.Show(String.Format("Adjust transfer volume from {0} cc to {1} cc?", m_objTransfer.TransferVolume, m_dblTempVolFromTo), "Adjust transfer", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
    xtTransferTransferVolume.Text = m_dblTempVolFromTo

Hope this helps,
Marcus Kramer 22-Feb-13 9:22am
CHill60 22-Feb-13 9:23am
My 5
vebi1000 22-Feb-13 9:34am
Thanks alot. its working perfect.
Fredrik Bornander 22-Feb-13 9:52am
Glad I could help.
Fredrik Bornander 6-Mar-13 13:32pm
If you copy the code from above then that is what will happen.
vebi1000 7-Mar-13 7:45am
Thank you very much, Sorry I am confused little bit. It is working perfectly what i want. I have confused myself and posted comment. sorry for that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170308.1 | Last Updated 22 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100