the index starts at 0, tryCart.Rows(Cart.Rows.Count-1).Delete()  

解决方案 »

  1.   

    Cart.Rows.Count的值为1, 但它的索引是0用 Cart.Rows(Cart.Rows.Count-1).Delete()  
      

  2.   

    执行Cart.Rows(Cart.Rows.Count-1).Delete()  这句后 ,Cart.Rows.Count的值才会是0
      

  3.   

    Cart.Rows.Add(dr)这句话后Cart.Rows.Count=1,使用的索引是Cart.Rows(0)
      

  4.   

    Cart.Rows(Cart.Rows.Count).Delete()  你删错地方了
      

  5.   

    Cart.Rows.Add(dr)'已经增加一行 Cart.Rows.Count=1Cart.Rows(Cart.Rows.Count).Delete()  ‘不存在索引1,,索引从0开始
      

  6.   

    try
    Cart.Rows.Count的值为1, 但它的索引是0用 Cart.Rows(Cart.Rows.Count-1).Delete()  
      

  7.   

    大家的意思我明白,添加新的一行索引为0,单要删除第0行数据时
    用Cart.Rows(Cart.Rows.Count-1).Delete()代码时,
    但提示错误:There is no row at position -1.这只能说明Cart.Rows.Count的数值为0
    我现在的情况是Cart.Rows.Add(dr)后,将CartView绑定到DataList,页面能显示出这条记录
    但Cart.Rows.Count就是等于0,按理说应该是1,这是我困惑的地方啊?