读书人

TableCell要怎样设定才不为null?听说标

发布时间: 2012-04-08 14:38:30 作者: rapoo

TableCell要怎样设定才不为null?听说标题要长,所以顺便抱怨一下为什么国庆放假我还要上班啊~!!!??
小破代码如下

If DividendType = 1 Then
Dim JackpotRolloverCell As TableCell
Dim JackpotAmountCell As TableCell
Select Case PoolCode
Case "D-T", "T-T", "6UP"
JackpotRolloverCell = New TableCell
JackpotAmountCell = New TableCell
JackpotRolloverCell.Text = "JackpotRolloverCell"
JackpotAmountCell.Text = "JackpotAmountCell"
End Select
DividendRow.Cells.Add(JackpotRolloverCell)---------> 就是这里
DividendRow.Cells.Add(JackpotAmountCell)----------还有这里
ApplyCellBorder(JackpotRolloverCell)
ApplyCellBorder(JackpotAmountCell)
JackpotRolloverCell.Style.Item("background-color") = RowColors(RowIndex Mod 2)
JackpotAmountCell.Style.Item("background-color") = RowColors(RowIndex Mod 2)

TableDividend.Rows.Add(DividendRow)
DividendRow = New TableRow
RowIndex = RowIndex + 1
End If


就是这里:code下面会显示标示warning的绿色曲线,warning: variable "JackpotRolloverCell" is used before it has been assigned a value. A null reference exception could result at run time.
还有这里:跟就是这里一样。。。。。。。。。。。。。。。。。

难道写了cell text还是会为null么? 不懂啊不懂。。。大虾救命。。T^T

[解决办法]


国庆快乐接分!
[解决办法]
要用new申明

读书人网 >VB Dotnet

热点推荐