2014-05-06 34 views
-1

我试图拉起某个buttonResult框内的一个按钮单击事件,基于选择什么单选按钮进行更改,但是当我创建它们并尝试将它们连接到无线电按钮检查选择,它表示“表达式不是一种方法。”'表达式不是方法'错误

任何人都知道为什么会发生这种情况?由于

Dim MsgBox1 As DialogResult = MessageBox.Show(String.Format("You have chosen to change your details to " + txtbox.Text + " percent"), "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) 

    If MsgBox1 = DialogResult.Yes Then 

    ElseIf MsgBox1 = DialogResult.No Then 

    End If 

    Dim MsgBox2 As DialogResult = MessageBox.Show("You have chosen to cease this service", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) 

    If MsgBox2 = DialogResult.Yes Then 

    ElseIf MsgBox2 = DialogResult.No Then 

    End If 

    If rdoEnable.Checked Then 
     MsgBox1() 
    End If 

    If rdoCancel.Checked Then 
     MsgBox2() 
    End If 
+3

这里有这么多的基本错误,我不确定你了解ASP.NET或VB.NET – freefaller

+0

看来你正在使用VB.NET WinForms应用程序而不是ASP.NET应用程序。我们能否让你澄清你想要达到的目标。看起来你有2个单选按钮。当选择一个时,您想要一个YesNo消息框与某个消息一起出现,并且当选择另一个单选按钮时,您想要一个YesNo消息框以不同的消息出现。那是对的吗?如果用户点击“是”而不是“否”,您希望发生什么? –

回答

1
If rdoEnable.Checked Then 
     MsgBox1() 
    End If 

它的发生是因为MsgBox1DialogResult类的实例,而不是一个方法。我不知道你在做什么,但这是无效的。

另外,您已将此标签标记为ASP.NET,因此我将假定这是一个Web应用程序。看起来您正在使用Windows窗体中的MessageBox类。你不能这样做,你需要坚持在Web上下文中提供的控件。使用jQuery DialogModalPopupExtender或其他一些工具在客户端创建对话框/弹出窗口。