HI,
i have an error to call module to my forms "Value of type 'Integer' cannot be converted to 'System.Data.DataTable'".
i have a module to fill data in the listview,
Module ModProcedure
Dim xsize As Integer
Public Sub FillListView(ByVal sqlData As DataTable, ByVal lvList As ListView, ByVal imageID As Integer)
Dim i As Integer
Dim j As Integer
lvList.Clear()
For i = 0 To sqlData.Columns.Count - 1
lvList.Columns.Add(sqlData.Columns(i).ColumnName)
Next i
For i = 0 To sqlData.Rows.Count - 1
lvList.Items.Add(sqlData.Rows(i).Item(0), imageID)
For j = 1 To sqlData.Columns.Count - 1
If Not IsDBNull(sqlData.Rows(i).Item(j)) Then
lvList.Items(i).SubItems.Add(sqlData.Rows(i).Item(j))
Else
lvList.Items(i).SubItems.Add("")
End If
Next j
Next i
For i = 0 To sqlData.Columns.Count - 1
xsize = lvList.Width / sqlData.Columns.Count - 8
lvList.Columns(i).Width = xsize
Next i
End Sub---
i used to call this function to my form but i am facing problem to call data table as below
Private Sub FrmWHMaster_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myCn As New dbconnection
Dim cnn As New SqlClient.SqlConnection(myCn.Getdbconn)
Dim sqlStr As String
cnn.Open()
sqlStr = "select * from userMaster"
Dim cmd1 As New SqlClient.SqlCommand(sqlStr, cnn)
cmd1.CommandType = CommandType.Text
FillListView(cmd1.ExecuteNonQuery, IstCurrentload, 0)
cnn.Close()
End Sub
This is the area i am getting error?please advice.
FillListView(cmd1.ExecuteNonQuery, IstCurrentload, 0)
Thanks,
Ali