ovo je samo pocetak i okacio sam da bih postavio par pitanja:
1)kada startujem aplikaciju i ugasim je u proccessima excel ostaje aktivan.Sta da ubacim da se excel gasi.
2)kako da datagrid povezem sa fajlom to jest da u datagridu budu podaci iz fajla?
ovo je za pocetak
a evo i koda :
Public Class Form1
Dim ap As New Microsoft.Office.Interop.Excel.Application
Dim file As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
file = "e:\proba.xls"
ap.Workbooks.Open(file)
ap.Visible = True
ap.UserControl = True
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ap.Range("a1").End(Microsoft.Office.Interop.Excel.XlDirection.xlDown).Offset(1, 0).Select()
ap.ActiveCell.Value = TextBox1.Text
ap.ActiveCell.Offset(0, 1).Value = TextBox2.Text
ap.ActiveCell.Offset(0, 2).Value = TextBox3.Text
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ap.ActiveWorkbook.Close()
ap.Quit()
End Sub
End Class