|
Public Class ReadFromExcel
Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowse.Click
If ofdOpenFile.ShowDialog() = Windows.Forms.DialogResult.OK Then
txtFileName.Text = ofdOpenFile.FileName
End If
End Sub
Private Sub btnRead_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRead.Click
If Not String.IsNullOrEmpty(txtFileName.Text) Then
Try
btnClose.Enabled = False
Dim OExcelHandler As New ExcelHandler()
Dim ds As DataSet = OExcelHandler.GetDataFromExcel(txtFileName.Text.Trim())
If ds IsNot Nothing Then
dgvExcelData.SelectionMode = DataGridViewSelectionMode.FullRowSelect
dgvExcelData.EditMode = DataGridViewEditMode.EditProgrammatically
dgvExcelData.DataSource = ds.Tables(0)
End If
Catch ex As Exception
Finally
btnClose.Enabled = True
End Try
End If
End Sub
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
Close()
End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am a Dot Net Developer working in MNC. I am interested to learn new technologies. I am always trying to improve my skills.
MCTS:ASP.NET 3.5
MCTS:WCF 3.5