首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

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

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

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申明

热点排行