sexta-feira, 24 de agosto de 2012

on


Imports System.Data.OleDb

Public Class Form1
    Inherits System.Windows.Forms.Form

    Dim strcon As String
    Dim tipo As Integer = 0
    Dim Tabela As DataTable = New DataTable("Tabela")

    Public Function EsquemaTabelas(ByVal conn As OleDbConnection) As DataTable
        Tabela = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"})
        Return Tabela
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        strcon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & txtarquivo.Text
        Dim conexao As New OleDbConnection(strcon)
        conexao.Open()
        Tabela = EsquemaTabelas(conexao)
        DataGridView1.DataSource = Tabela
        conexao.Close()
    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click

        If Me.OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            Me.txtarquivo.Text = Me.OpenFileDialog1.FileName
        End If

    End Sub

    Private Sub Form1_FormClosed(sender As Object, e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        End
    End Sub

End Class


Pegue o projeto neste link: http://www.mediafire.com/?ldughm9eu18vg61

Abraços e até a próxima....

0 comentários:

Postar um comentário