Hi, I have extracted one row of data with multiple columns from an excel file to a Datatable, and I tried to bind all this data to one specific column on a datagridviewer called "index". with the code below, if I use
DataGridView3.Rows.Add(row.ItemArray), it only gives me the first cell of the datatable. If I use DataGridView3.DataSource=dt5, it puts all data horizontaly instead of what I want vertically. any idea ? thanks
Using cn As New OleDbConnection With {.ConnectionString = String.Format(ConnectionNoHeader3, FileName3)} cn.Open() Dim cmd As OleDbCommand = New OleDbCommand(<Text> SELECT * FROM [<%= SheetName3 %>$] where date=<%= CStr(CurrentWeek) %></Text>.Value, cn ) Dim dt5 As New DataTable dt5.Load(cmd.ExecuteReader) For Each row As DataRow In dt5.Rows DataGridView3.Rows.Add(row.ItemArray) Next DataGridView.DataSource=dt5 End Using