[英]VB.NET Throws: Conversion from string “” to type 'Double' is not valid
創建復選框時出現此錯誤,運行查詢后將引發錯誤,我試圖找出解決問題的方法將近4個小時,但沒有運氣。 我之前所做的是我嘗試將其轉換為兩倍(因為錯誤告訴我要進行轉換),但是沒有運氣,並且還嘗試將字符串轉換為(“ True”或“ False”),但仍然沒有運氣。 我被困在這里。 有人可以提供解決方法的想法。 我為此使用了復選框。 這是我的代碼:
If Trim(grdOrderItems.Rows(intGrdTemp).Cells(38).Value.ToString) = "Y" Then
chbOrdTaxable.Checked = True
Else
chbOrdTaxable.Checked = False
End If
這段代碼拋出了一個錯誤(上面提到)。
實際上,string.trim所做的是例如通過指定字符修剪字符串
dim string1 as string = "*** Who knows the correct answer!"
string1.trim (" ", "*") ' this will return (Who Knows the correct answer!)
'without the asterisk (*) and the first space ( )
因此請確保首先傳遞給string.trim的參數是一個char
在您的情況下,我假設返回值是一個字符串,而您想要做的是從字符串中獲取第一個字符,因此以下內容將有所幫助
dim string1 as string = grdOrderItems.Rows(intGrdTemp).Cells(38).Value.ToString
dim char1 as char = string1.substring(0,1) 'this will return the first character only
希望我說對了! 我可以幫忙
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.