تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] استيراد أسماء الزبائن من ملف Excel إلى List Box معين
#4
الحمد لله والشكر لله رب العالمين .
تصحيح صغير على كود الفتح في حال لم تختر ملف من سيعطيك خطأ من السرعة لم انتبه في شرط If open.ShowDialog Then نسيت ان اكتب تتمة الشرط :

PHP كود :
       Dim open As New OpenFileDialog
        open
.Filter "Excel File |*.Xls;*.Xlsx"
 
       If open.ShowDialog Windows.Forms.DialogResult.OK Then
            Dim oExcel 
As Object CreateObject("Excel.Application")
 
           Dim oBook As Object oExcel.Workbooks.Open(open.FileName''"e:\1.xlsx"
 
           Dim oSheet As Object oBook.Worksheets(1)
 
           Dim i As Integer
            Dim cell 
As String
            Dim cell1 
As String
            For i 
0 To AscW(ListBox1.Items.Count.ToString()(1)) - 1
                cell 
"A" Convert.ToString(1)
 
               cell1 "B" Convert.ToString(1)
 
               cell oSheet.Range(cell).Value
                cell1 
oSheet.Range(cell1).Value
                If cell 
"" Then
                    Exit 
For
 
               Else
                    ListBox1
.Items.Add(cell " | " cell1)
 
               End If
 
           Next
            oExcel
.Quit()
 
       End If 
الرد }}}
تم الشكر بواسطة: technomedia


الردود في هذا الموضوع
RE: استيراد أسماء الزبائن من ملف Excel إلى List Box معين - بواسطة asemshahen5 - 04-12-20, 11:46 PM


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم