Click here to Skip to main content
15,891,907 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am trying to update vb6 code into c#. I have vb6 code like this
VB
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.
C#
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
Updated 22-Feb-13 3:16am
v2
Comments
Chris Reynolds (UK) 22-Feb-13 9:20am    
Are you getting an error? If so, what is it?

1 solution

You could try something like this;

C#
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,
Fredrik
 
Share this answer
 
Comments
fjdiewornncalwe 22-Feb-13 9:22am    
+5.
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.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900