i have used below code in vb.net project in same project 1 - 2 forms is working but 1 form not work following erorr not converted datatable to datatable() please anybody lookin and help. Thanks in advance.
Severity Code Description Project Path File Line Suppression State Error BC30311 Value of type 'DataTable' cannot be converted to 'DataTable()'.504 N/A
functioncode as below.
Private Sub btnSDEANew_Click(sender As Object, e As EventArgs) Handles btnSDEANew.Click
Dim dt As New DataTable
Dim spath, scsvpath As String
Dim strSCPath = GetSettings("ExportInwardFilePath") & "\AXIX_" & GetSettings("CustName") & "\" & Format(dtp_ChDate.Value, "ddMMyyyy").ToString() 'GetSettings("ExportOutwardBankFile")
scsvpath = strSCPath + "\"
For i = 1 To cBatchDetails.Rows.Count - 1
spath = strSCPath + "\" + "ITEMS_" + Format(dtp_ChDate.Value, "yyyyMMdd") + "_" + Format(Val(cBatchDetails.Item(i, "BatchID").ToString()), "00000") + "\"
DT.Columns.Add("C1", GetType(String))
DT.Columns.Add("C2", GetType(String))
DT.Columns.Add("C3", GetType(String))
DT.Columns.Add("C4", GetType(String))
DT.Columns.Add("C5", GetType(String))
DT.Columns.Add("C6", GetType(String))
DT.Columns.Add("C7", GetType(String))
DT.Columns.Add("C8", GetType(String))
Dim msiD As Integer
Dim _CTSinstruments = GetBatchDetails(cBatchDetails.Item(i, "BatchID"))
msiD = 1
For Each DR In _CTSinstruments
If msiD = 1 Then
DT.Rows.Add("004", "225", Now.ToString("ddMMyyyy"), DR.NoOfChqs, DR.SlipAmount, "LICHO", "LCC", "0")
msiD = msiD + 1
Exit For
End If
Next
Dim x1 As New Int64
x1 = 10400201001
Dim x As String
x = Now.ToString("ddMMyyyy") + "400211002" + Format(x1, "0000000000000") + "0004"
For Each dr In _CTSinstruments
DT.Rows.Add(x, Format(dr.ChqNo, "000000"), Now.ToString("ddMMyyyy"), Format(Val(dr.MICR3), "00"), Format(Val(Mid(dr.MICR1, 1, 3)), "000"), Format(Val(Mid(dr.MICR1, 4, 3)), "000"), Format(Val(Mid(dr.MICR1, 7, 3)), "000"), dr.ChqAmount)
Next
DatatablesToExcel(dt, spath, "data.xlsx")
Exit For
Next
End Sub