本文介绍了如何在c#中实现fallowing VB6代码。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将vb6代码更新为c#。我有这样的vb6代码
Hi,
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
我试图使用某个工具将此代码转换为c#,代码就是这样。
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))
概念是它必须显示上述消息并询问是或否。这里vbYesNo在c#中是不可用的。我如何在c#中实现相同的概念。
请帮助我。
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.
推荐答案
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
}
希望这会有所帮助,
Fredrik
Hope this helps,
Fredrik
这篇关于如何在c#中实现fallowing VB6代码。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!