在vb.net窗体中为动态生成的gridview单元格赋值

时间:2015-01-07 04:38:56

标签: vb.net gridview

我正在尝试将数据集中的值分配给动态生成的gridview文本框列,但是值在单元格中不可见但是已经分配了。请帮助我。

Dim i, j As Integer
     For i = 0 To ds.Tables(4).Rows.Count - 1
        For j = 0 To grdincomes.Rows.Count - 1
             If ds.Tables(4).Rows(i)("Income_Head").ToString.Trim = grdincomes.Rows(j).Cells("Income_Head").Value Then
                            grdincomes.Rows(j).Cells("txtamtpay").Value = ds.Tables(4).Rows(i)("amountpaid").ToString.Trim
                            grdincomes.Rows(j).Cells("cmbinctype").Value = ds.Tables(4).Rows(i)("paymentmode").ToString.Trim
                            'MessageBox.Show(grdincomes.Rows(j).Cells("txtamtpay").Value)
                            'MessageBox.Show(grdincomes.Rows(j).Cells("cmbinctype").Value)
                        End If
                    Next
                Next
            End If

0 个答案:

没有答案