Click here to Skip to main content
Rate this: bad
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 3:15am
Edited 22-Feb-13 3:16am
Chris Reynolds (UK) at 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 at 22-Feb-13 9:22am
CHill60 at 22-Feb-13 9:23am
My 5
vebi1000 at 22-Feb-13 9:34am
Thanks alot. its working perfect.
Fredrik Bornander at 22-Feb-13 9:52am
Glad I could help.
Fredrik Bornander at 6-Mar-13 13:32pm
If you copy the code from above then that is what will happen.
vebi1000 at 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
0 Sergey Alexandrovich Kryukov 474
1 OriginalGriff 388
2 Maciej Los 385
3 CPallini 194
4 CHill60 180
0 OriginalGriff 6,152
1 Sergey Alexandrovich Kryukov 5,312
2 Maciej Los 3,279
3 Peter Leow 3,184
4 DamithSL 2,490

Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 22 Feb 2013
Copyright © CodeProject, 1999-2014
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