My program opens an excel sheet and adds the data in the cell in a textbox
However, two of the columns consists of Date and the other Time.
The Date cell shows OK but the cell containing time should show 16:00:05
but instead it shows 0.666728618101852
Can anyone show a complete beginner how to correct this
Thanks in advance
Code:
Imports Excel = Microsoft.Office.Interop.Excel
Public Class Form1
Dim APP As New Excel.Application
Dim worksheet As Excel.Worksheet
Dim workbook As Excel.Workbook
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
workbook = APP.Workbooks.Open("C:\Users\user\Desktop\2021-01-19.xlsx")
worksheet = workbook.Worksheets("sheet1")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click
TextBox1.Text = worksheet.Cells(2, 1).Value
TextBox2.Text = worksheet.Cells(2, 2).Value
TextBox3.Text = worksheet.Cells(2, 3).Value
TextBox4.Text = worksheet.Cells(2, 4).Value
TextBox5.Text = worksheet.Cells(2, 5).Value
End Sub
Private Sub Form1_FormClosed(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.FormClosedEventArgs) _
Handles MyBase.FormClosed
'workbook.Save()
workbook.Close()
APP.Quit()
End Sub
End Class