0
我有一個函數,它可以成功地將數據從CSV加載到datagridview。問題在於某些列中有很長的數字,並且它們出現諸如5.00E + 14。理想情況下,我想在CSV文件中更改該值,因爲我打算將CSV導出到另一個數據庫。有任何想法嗎?從CSV導入到DataGridView沒有科學格式的數字
Dim Lines As String() = File.ReadAllLines(sFile)
Dim Fields As String()
Fields = Lines(0).Split(New Char() {","c})
Dim Cols As Integer = Fields.GetLength(0)
Dim dt As New DataTable()
'1st row must be column names; force lower case to ensure matching later on.
For i As Integer = 0 To Cols - 1
dt.Columns.Add(Fields(i).ToLower(), GetType(String)).AllowDBNull = True
Next
Dim Row As DataRow
' = 1 to skip the first line
For i As Integer = 1 To Lines.GetLength(0) - 1
Fields = Lines(i).Split(New Char() {","c})
Row = dt.NewRow()
For f As Integer = 0 To Cols - 1
Row(f) = Fields(f)
Next
dt.Rows.Add(Row)
Next
DataGridView2.DataSource = dt
我想使用VB.NET在WinForms中的數據網格上顯示格式化的數字。更改CSV文件中的內容將無濟於事。 – alwaysVBNET