microsoft.visualbasic.dll附加信息中出现了类型为'system.argumentexception'的未处理异常:参数'prompt'无法转换为'string'类型。 [英] An unhandled exception of type 'system.argumentexception' occurred in microsoft.visualbasic.dll additional information: argument 'prompt' cannot be converted to type 'string'.

查看:783
本文介绍了microsoft.visualbasic.dll附加信息中出现了类型为'system.argumentexception'的未处理异常:参数'prompt'无法转换为'string'类型。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..

我得到

 microsoft.visualbasic.dll中发生未处理的System.ArgumentException类型异常

其他信息:参数'Prompt'无法转换为'String'类型。

Visual Studio 2002 Windows应用程序中的错误。



 如果 MsgBox( 你确定吗?你想删除MTR吗? .ToString(),MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton2 + MsgBoxStyle.Question, Me  .Text)= MsgBoxResult.Yes 然后 


Dim sqlcon 作为 SqlConnection(BusinessObject.ConnectionString)
如果 sqlcon。 State = ConnectionState.Closed 然后 sqlcon.Open()
' sqlTrans = BusinessLayer.BusinessObject.Connection.BeginTransaction
sqlTrans = sqlcon.BeginTransaction()
sqlCmd.Transaction = sqlTrans
sqlCmd.CommandType = CommandType.Text

' '更新条形码中的库存
Dim rsBarCode As New ADODB.Recordset()
rsBarCode.Open( SELECT * FROM BarcodeBin WHERE MTRId ='&修剪(selMTR.Id)& 'AND CalculatedFor IS NOT NULL,con, 2 3
Dim tmpFlg 正如 布尔 = 错误
如果 rsBarCode.EOF = True 那么
' '如果任何未分配给OC的MTR项目,可以删除MTR
tmpFlg = True
结束 如果
rsBarCode.Close ()
如果 tmpFlg = True 然后
Dim qry As String = UPDATE BarcodeBin SET MTRId = NULL,MTRRaised = 0,DeBondDate = NULL,DeBondNumber = NULL,StockPlace ='B'Where MTRId ='& ;修剪( Me .selMTR.Id)& '
sqlCmd.CommandText = qry
sqlCmd.ExecuteNonQuery()
其他
退出 Sub
结束 如果

sqlTrans.Commit()
MsgBox( MTR:'& .selMTR.MTRNo& '已被删除。,MsgBoxStyle.Information , Me .Text)
ShowingMTR()
Me .txtReason.Text =

End 如果
Else
MsgBox( 请选择MTR。 ,MsgBoxStyle.Information, Me .Text)
退出 Sub

结束 如果





 sqlCmd.ExecuteNonQuery()

遭遇时出错。



任何帮助表示赞赏。





谢谢....



我尝试了什么:



我几乎都提到了.net帮助论坛。我没有得到任何解决方案。即使我从代码中删除了确认是/否语句,仍然触发相同的错误。

解决方案

 如果 MsgBox( 您确定要删除MTR吗?。 ToString(),MsgBoxStyle.YesNo + 



为什么在常量字符串值上调用 ToString


错误消息表明提示参数存在问题/en-us/library/139z2azd(v=vs.90).aspx\">MsgBox函数(Visual Basic) [ ^ ]。



尝试像这:

  Dim  prompt =  您确定要删除MTR吗? ? 
Dim style = MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton2 + MsgBoxStyle.Question
Dim response = MsgBox(提示,样式, .Text)
如果 response = MsgBoxResult.Yes 然后
' ...
结束 如果


Hi..
Im getting

An unhandled exception of type 'System.ArgumentException' occurred in microsoft.visualbasic.dll

Additional information: Argument 'Prompt' cannot be converted to type 'String'.

error in Visual Studio 2002 windows application.

If MsgBox("Are you sure Do you want to delete MTR?".ToString(), MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton2 + MsgBoxStyle.Question, Me.Text) = MsgBoxResult.Yes Then


        Dim sqlcon As New SqlConnection(BusinessObject.ConnectionString)
        If sqlcon.State = ConnectionState.Closed Then sqlcon.Open()
        'sqlTrans = BusinessLayer.BusinessObject.Connection.BeginTransaction
        sqlTrans = sqlcon.BeginTransaction()
        sqlCmd.Transaction = sqlTrans
        sqlCmd.CommandType = CommandType.Text

        '' updating stock place in barcodebin
        Dim rsBarCode As New ADODB.Recordset()
        rsBarCode.Open("SELECT * FROM BarcodeBin WHERE MTRId='" & Trim(selMTR.Id) & "' AND CalculatedFor IS NOT NULL", con, 2, 3)
        Dim tmpFlg As Boolean = False
        If rsBarCode.EOF = True Then
            '' If any of the MTR item not alloted to OC , can delete MTR
            tmpFlg = True
        End If
        rsBarCode.Close()
        If tmpFlg = True Then
            Dim qry As String = "UPDATE BarcodeBin SET MTRId=NULL, MTRRaised=0, DeBondDate =NULL, DeBondNumber=NULL, StockPlace='B' WHERE MTRId='" & Trim(Me.selMTR.Id) & "'"
            sqlCmd.CommandText = qry
            sqlCmd.ExecuteNonQuery()
        Else
            Exit Sub
        End If

        sqlTrans.Commit()
        MsgBox("MTR : '" & Me.selMTR.MTRNo & "' has been deleted.", MsgBoxStyle.Information, Me.Text)
        ShowingMTR()
        Me.txtReason.Text = ""

    End If
Else
    MsgBox("Please select MTR.", MsgBoxStyle.Information, Me.Text)
    Exit Sub

End If



Getting error when "

sqlCmd.ExecuteNonQuery()

" encounters.

Any help appreciated.


Thank you....

What I have tried:

I referred almost all .net help forum. im not getting any solution. Even i removed Confirmation Yes/No statement from code, still its triggering same error.

解决方案

If MsgBox("Are you sure Do you want to delete MTR?".ToString(), MsgBoxStyle.YesNo + 


Why are you calling ToString on a constant string value?


The error message indicates that there is a problem with the Prompt parameter of the MsgBox Function (Visual Basic)[^].

Try something like this:

Dim prompt = "Are you sure Do you want to delete MTR?"
Dim style = MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton2 + MsgBoxStyle.Question
Dim response = MsgBox(prompt, style, Me.Text)
If response = MsgBoxResult.Yes Then
' ...
End If


这篇关于microsoft.visualbasic.dll附加信息中出现了类型为'system.argumentexception'的未处理异常:参数'prompt'无法转换为'string'类型。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆