2016-12-13 1017 views
0

こんにちは私はVB 2015のようにVBを学び始めました。私はBryon NewsomeによるBeginning Visual Basic 2015の練習をしています。出版社フォーラムや出版社自身から助けを得ることはできません。以前の練習でこのタイプのエラーを修正することができましたが、修正するために以下のものを見ることはできません。 bc30456エラー... xxxx yyyyのメンバーではありません

Public Class Form1 
    Private Sub btn2Buttons_Click(sender As Object, 
    e As EventArgs) Handles btn2Buttons.Click 
     If MessageBox.Show("Your Internet connection will now be closed.", 
      "Network Notification", MessageBoxButtons.OKCancel, 
      MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) _ 
    = Windows.Forms.DialogResult.OK Then 

      lblResults.Text = "OK Clicked" 
      'Call some method here 
     Else 
      lblResults.Text = "Cancel Clicked" 
      'Call some method here 
     End If 
    End Sub 


End Class 

次の2つのエラーメッセージからである:

Severity Code Description Project File Line 
Error BC30456 'OKCancel' is not a member of 'MessageBoxButtons'. MessageBoxButtons E:\Document\Programing\VB\MessageBoxButtons\MessageBoxButtons\Form1.vb 5 

Severity Code Description Project File Line 
Error BC30456 'Forms' is not a member of 'Windows'. MessageBoxButtons E:\Document\Programing\VB\MessageBoxButtons\MessageBoxButtons\Form1.vb 7 

つのラベルがあります:textプロパティに何もないlblResultsは

をクリックここ

は、214〜215ページからコードがあります

ボタンが1つあります:btn2buttons with textプロパティ2ボタン。

+2

あなたはMessageBoxButtonsと同じプロジェクト名を使用しているため、vbはプロジェクトのメンバーだと考えています。これらの定数が属する完全修飾名を追加します。System.Windows.Forms.MessageBoxButtons.OKCancel –

+0

こんにちは...上記のコードで提案した行をどこに置くのですか? VBは私が置いた場所で不平を言った。私はVBで最初に正しいです!ありがとう。 – youkuya

答えて

0
If MessageBox.Show("Your Internet connection will now be closed.", 
     "Network Notification", System.Windows.Forms.MessageBoxButtons.OKCancel, 
     System.Windows.Forms.MessageBoxIcon.Information, System.Windows.Forms.MessageBoxDefaultButton.Button1) = Windows.Forms.DialogResult.OK Then 

      lblResults.Text = "OK Clicked" 
      'Call some method here 
     Else 
      lblResults.Text = "Cancel Clicked" 
      'Call some method here 
     End If 
関連する問題