用数组把,datagrid的数据源支持数组的!

解决方案 »

  1.   

    dim arr(0) as string
    arr(0)="first"
    datagrid1.setdatabinding(arr,nothing)
    就行了
      

  2.   

    谢谢,有没有象dataGrid1.cell(1,1)="first"那样直接写入的?
      

  3.   

    错了,这样出来的是长度,应该这么写,我用vb.net写的,自己转过去
     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim arr(0) As item
            arr(0) = New item
            arr(0).text = "first"
            DataGrid1.SetDataBinding(arr, Nothing)
        End Sub
    End Class
    Public Class item
        Private m_text As String
        Public Property text() As String
            Get
                Return m_text
            End Get
            Set(ByVal Value As String)
                m_text = Value
            End Set
        End Property
      

  4.   

    You can new a DataTable
    Then set the DataSource Property of the DataGrid as your DataTable.
      

  5.   

    Agree with polarlm(今年本命年)
      

  6.   

    我也觉得可以用datatable来作能用高级为啥不用哪
      

  7.   

    在ItemDataBind事件里直接设置就是了。
    if(e.Item.ItemIndex==1)
    {
        e.Item.Cell[1].Text = "first";
    }