我正在尝试在vb.net中制作日历,但我遇到了这个问题。我想将一些文本追加到现有的数据表行中。当我观察我的调试器时,它说:“为了评估索引属性,必须限定属性,并且必须由用户显式提供参数。”。
Dim aantalRijen As Integer = 1
For x = 0 To 6
Dim dttopdrachten As New DataTable
dttopdrachten = opdrachtendao.getOpdrachtenByDate(Today.AddDays(x))
If dttopdrachten.Rows.Count > aantalRijen Then
aantalRijen = dttopdrachten.Rows.Count
End If
Next
For z = 0 To aantalRijen - 1
Dim r As DataRow
r = dttAgenda.NewRow()
dttAgenda.Rows.InsertAt(r, z)
Next
For i = 0 To 6
Dim aantalItems As Integer = 0
Dim dttopdrachten As New DataTable
dttopdrachten = opdrachtendao.getOpdrachtenByDate(Today.AddDays(i))
aantalItems = dttopdrachten.Rows.Count
For j = 0 To aantalItems - 1
Dim info As String = dttopdrachten.Rows(j).Item(0).ToString & vbCrLf & dttopdrachten.Rows(j).Item(2).ToString & vbCrLf & dttopdrachten.Rows(j).Item(3).ToString & vbCrLf & dttopdrachten.Rows(j).Item(4).ToString & vbCrLf & dttopdrachten.Rows(j).Item(5).ToString & vbCrLf & dttopdrachten.Rows(j).Item(6).ToString
dttAgenda.Rows(j).Item(i) = info
Next
Next
dgvAgenda.DataSource = dttAgenda
在上面的代码中,我首先计算我必须要生成多少行。然后我将数量的行添加到数据表中(之前添加了列)。直到这里它可以工作,但是当我继续调试时,我得到了错误。我试过谷歌搜索,但到目前为止没有什么可以帮助我。
答案 0 :(得分:0)
似乎问题已经解决而没有改变任何东西。所以,如果有人想制作日历。这是解决方案;)