在Visual C ++.Net中帮助我 [英] help me in Visual C++.Net
本文介绍了在Visual C ++.Net中帮助我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我将搜索项目从c#转换为VC ++.Net,但是有1个错误我找不到答案..
在我的项目中,我有浏览按钮,但没有保存我选择的文件..代码中有1条指令无法将其转换..
这是指令(DialogResult1.OK)
这是浏览按钮的代码:
hi all,
i convert a search project from c# to VC++.Net but there is 1 error i can''t find the answer..
in my project i have browse button but doesn''t save the file which i pick it.. there is 1 instruction in the code can''t convert it ..
this is the instruction (DialogResult1.OK)
and this is the code for the browse button :
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
if (openFileDialog1->ShowDialog() == DialogResult1.OK)
{
textBox1->Text = openFileDialog1->FileName;
StreamReader ^sr =gcnew StreamReader(textBox1->Text);
textBox4->Text = sr->ReadToEnd();
}
这是错误:
and this is the error :
error C2228: left of '.OK' must have class/struct/union
1> type is 'System::Windows::Forms::DialogResult ^'
请帮助我..thanx:D:D
please help me..thanx :D:D
推荐答案
如果这是C ++,则应该使用::DialogResult::OK
参见此文件(在C ++和C#中有示例):
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.dialogresult.aspx#Y953 [
If this is C++ then you should probably use::DialogResult::OK
See this (has examples in C++ and C#):
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.dialogresult.aspx#Y953[^]
取出"1":
Take the ''1'' out:
if (openFileDialog1->ShowDialog() == DialogResult1.OK)
成为
if (openFileDialog1->ShowDialog() == DialogResult.OK)
这篇关于在Visual C ++.Net中帮助我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文