منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : طلب تحويل كود vb6 الى كود vb 2012
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
الكود التالي يعمل معي في vb 6 لكن اريد ان اكتبه في vb 2012  ممكن احد يحوله لي 
Dim xl As New Excel.Application
Dim xlw As Excel.Workbook
Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Set xlw = xl.Workbooks.open(app.path & "\book1.xlsx")
        xlw.sheets("sheet1").select()
        TextBox1.Text = xlw.Application.cells(1, 1).value
        TextBox2.Text = xlw.Application.cells(1, 2).value
        TextBox3.Text = xlw.Application.cells(1, 3).value
        xlw.close()
       set xlw = Nothing
       set xl = Nothing
    End Sub
End Class
PHP كود :
'أضف مكتبة Microsoft.Office.Interop الى مكتبات البرنامج ثم اعمل لها امبورت'
Imports Microsoft.Office.Interop
Public Class Form1
    Private Sub Button1_Click
(sender As ObjectAs EventArgsHandles Button1.Click
        Dim xl 
As New Excel.Application
        Dim xlw 
As Excel.Workbook

        xlw 
xl.Workbooks.Open(My.Application.Info.DirectoryPath "\Test.xls")
 
       xlw.Sheets("sheet1").select()
 
       TextBox1.Text xlw.Application.Cells(11).value
        TextBox2
.Text xlw.Application.Cells(12).value
        TextBox3
.Text xlw.Application.Cells(13).value
        xlw
.Close()
 
       xlw Nothing
        xl 
Nothing
    End Sub
End 
Class 
(27-11-19, 10:42 AM)asemshahen5 كتب : [ -> ]
PHP كود :
'أضف مكتبة Microsoft.Office.Interop الى مكتبات البرنامج ثم اعمل لها امبورت'
Imports Microsoft.Office.Interop
Public Class Form1
    Private Sub Button1_Click
(sender As ObjectAs EventArgsHandles Button1.Click
        Dim xl 
As New Excel.Application
        Dim xlw 
As Excel.Workbook

        xlw 
xl.Workbooks.Open(My.Application.Info.DirectoryPath "\Test.xls")
 
       xlw.Sheets("sheet1").select()
 
       TextBox1.Text xlw.Application.Cells(11).value
        TextBox2
.Text xlw.Application.Cells(12).value
        TextBox3
.Text xlw.Application.Cells(13).value
        xlw
.Close()
 
       xlw Nothing
        xl 
Nothing
    End Sub
End 
Class 
شكرا شكرا شكرا لك

اخي 
[b]asemshahen5[/b]  


 الملف بالمرفقات لم ينجح معي لا اعلم مالخطأ اضفت الملف مع الاكسل 
اضف هذه المكتبة الى مكتبات المشروع سيعمل باذن الله .

المكتبة في المرفقات .
(27-11-19, 02:59 PM)asemshahen5 كتب : [ -> ]اضف هذه المكتبة الى مكتبات المشروع سيعمل باذن الله .

المكتبة في المرفقات .





مازال يظهر الخطأ
اضف هذا السطر :

PHP كود :
Imports Microsoft.Office.Interop.Excel 

اضف هذا السطر :

PHP كود :
Imports Microsoft.Office.Interop.Excel