超级郁闷!分说明WEB窗体和WIN窗体!真真的令人难受!System.Web.UI.WebControls无法转变成为system.windows.forms.control!
我为了在WEB中使用MESSAGE警告框,引入了“Imports System.Windows.Forms”,可是在这样的饿情况下,我的确达到了“在WEB中使用MESSAGE警告框”这一目的,然而却引起了如下错误:
System.Web.UI.WebControls无法转变成为system.windows.forms.control!
因为我的datagrid在编辑时,我的绑定列使用了textbox控件,在没有引入System.Windows.Forms,该部分完全正常,这是为什么啊!相关代码如下:
Imports System.Windows.Forms
‘引发MessageBox.Show
Private Sub BtnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDelete.Click
BtnDoDelete.Visible = True
MessageBox.Show("该操作将删除与本条记录相关的所有数据!", "警告", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification)
End Sub
’datagrid更新部分的代码
'取得字段总数
Dim CurrentTextBox As TextBox
ZiDuanZongShu = e.Item.Cells.Count
'给update中的参数赋值
If e.Item.ItemIndex > -1 Then
For ZiDuanIndex = 2 To 7
CurrentTextBox = e.Item.Cells(ZiDuanIndex).Controls(0)
ZiDuanValue = CurrentTextBox.Text
AdaSql2.UpdateCommand.Parameters(ZiDuanIndex - 2).Value = ZiDuanValue
Next
为什么啊。难道鱼和猴长不能兼得吗?