2011-04-22 5 views
1

내 메시지 상자가 팝업으로 표시되어 사용자에게 응용 프로그램의 새 버전을 다운로드 할 것인지 묻는 메시지가 나타나면 아니오라고 말하면 종료하고 다운로드 할 필요가 있음을 알립니다. 새 사본을 계속 사용하십시오. 그들이 말하는 경우, 그것은 앞서 언급 한 웹 주소로 브라우저를 엽니 다. 지금은 메시지 상자가 나타나고 아무 것도 나타나지 않습니다. 그러나, 내가 코드를 내 친구에게 주었을 때마다 그는 그것을 시도했다. 여기 뭐가 잘못 됐니? 필자는 Microsoft Framework 4.0으로 컴파일했습니다.MessageBox에 C 텍스트가 표시되지 않습니다.

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Windows.Forms; 

namespace ProjectTest 
{ 
    public partial class Form1 : Form 
{ 
    public Form1() 
    { 
     InitializeComponent(); 
    } 

    private void Form1_Load(object sender, EventArgs e) 
    { 
     Form1_FormClosing(); 
    } 

    private void Form1_FormClosing() 
    { 
    const string message = 
    "There's an updated version of this program available. Would you like to download now?"; 
const string caption = "Please update"; 
var result = MessageBox.Show(message, caption, 
          MessageBoxButtons.YesNo, 
          MessageBoxIcon.Question); 

// If the no button was pressed ... 
if (result == DialogResult.No) 
{ 
    MessageBox.Show("Program will close now. If you want to use this program please update to the newest version.", "Please update"); 
    this.Close(); 
} 
else if (result == DialogResult.Yes) 
{ 
    System.Diagnostics.Process.Start("http://www.google.com"); 
    this.Close(); 
} 
} 

    } 
} 
+0

코드 보인다. 네가 준 친구는 너와 같은 운영 체제를 운영하고 있었 니? 위젯의 크기와 스타일이 버전마다 변경되어 상황이 다르게 표시됩니다. –

+0

문제는 Visual Studio 2008 및 2010에서 Windows 7에서 실행하고 컴파일 한 것입니다. 작동하지 않았습니다. 그런 다음 XP에서 VS 2010으로 실행했지만 여전히 작동하지 않았습니다. 4.0과 3.5을 시도했지만 여전히 작동하지 않았습니다. 지금 당장 단어를 잃어 버렸습니다. – JacksonDaHaxz

+0

나는 그 변화를 만들었고, 메시지 상자는 여전히 공백으로 나타난다. – JacksonDaHaxz

답변

0

이 시도 : 그것은 작동해야처럼

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Windows.Forms; 

namespace ProjectTest 
{ 
    public partial class Form1 : Form 
{ 
    public Form1() 
    { 
     InitializeComponent(); 
    } 

    private void Form1_Load(object sender, EventArgs e) 
    { 
     this.Close(); 
    } 

    private void Form1_FormClosing() 
    { 
    const string message = 
    "There's an updated version of this program available. Would you like to download now?"; 
const string caption = "Please update"; 
var result = MessageBox.Show(message, caption, 
          MessageBoxButtons.YesNo, 
          MessageBoxIcon.Question); 

// If the no button was pressed ... 
if (result == DialogResult.No) 
{ 
    MessageBox.Show("Program will close now. If you want to use this program please update to the newest version.", "Please update"); 
       e.Cancel = false; 
} 
else if (result == DialogResult.Yes) 
{ 
    System.Diagnostics.Process.Start("http://www.google.com"); 
       e.Cancel = false; 
} 
} 

    } 
} 
+0

오류 예상되는 클래스, 대리자, enum, 인터페이스 또는 구조체 – JacksonDaHaxz

+0

전체 코드를 게시합니다. 잘못된 메시지를 얻기 위해 일부 "}"또는 다른 기호 또는 잘못된 네임 스페이스가 누락되었을 수 있습니다. ** 오류 예상되는 클래스, 대리자, enum, 인터페이스 또는 구조체 ** – Maidot

관련 문제