如何获取Datagridview的电话号码列中的所有行的值,并将其传递给我的数字字符串数组

时间:2014-11-26 08:32:02

标签: vb.net datagridview

表单加载包含此功能

Public Sub LoadDataAll()
    grdAll.DataSource = Nothing
    grdAll.Columns.Clear()
    mycom.Connection = cn
    mycom.CommandText = "SELECT concat_ws(',', LastName, FirstName, MiddleName) as 'Applicant Name',CDate as 'Date of Application', DPosition as 'Desired Position', Cellphone as 'Phone Number' FROM tbl_applicant"

    Dim myadap As New MySqlDataAdapter(mycom)
    Dim mydt As New DataTable

    myadap.Fill(mydt)
    grdAll.DataSource = mydt

    myadap.Dispose()
    mydt.Dispose()
End Sub

我的按钮包含

Private Sub btnSendAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSendAll.Click
    For i As Integer = 0 To grdAll.RowCount - 1
        Number(i) = (grdAll.Rows(i).Cells(3).Value.ToString())
    Next
End Sub

我想获取Datagridview的电话号码列中所有行的值,并将其传递给我的Dim number as String()数组,但我总是得到错误object reference not set to an instance of an object。任何帮助的人都很感激..

0 个答案:

没有答案