التنبيهات التالية ظهرت :
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 864 - File: showthread.php PHP 7.4.33 (Linux)
File Line Function
/showthread.php 864 errorHandler->error



تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[تم الحل] مشكلة فى تحويل هذا الكود الى كلاس
#1
السلام عليكم ورحمة الله وبركاته
بحاول تحويل هذا الكود الى كلاس لكن حين المناداة عليه يظهر اخطاء 


كود :
Dim inputs As HtmlElementCollection
       inputs = WebBrowser1.Document.GetElementsByTagName("a")
       For Each item As HtmlElement In inputs
           If item.GetAttribute("href").Contains("groups")  AndAlso (Not item.GetAttribute("href").Contains("create")) Then


               CheckedListBox1.Items.Add(item.GetAttribute("href").ToString())
               CheckedListBox2.Items.Add(item.InnerText.ToString)
               Dim checked As Boolean = True
             
               Button1.Enabled = False
           End If
       Next item

حاولت بهذا
كود :
Imports System.Text.RegularExpressions
Public Class Class1
   Public Shared Sub post(wb As WebBrowser, List As CheckedListBox)
       Dim inputs As HtmlElementCollection
       inputs = wb.Document.GetElementsByTagName("a")
       For Each item As HtmlElement In inputs
           If item.GetAttribute("href").Contains("groups")  AndAlso (Not item.GetAttribute("href").Contains("create")) Then


               List.Items.Add(item.GetAttribute("href").ToString())
               List.Items.Add(item.InnerText.ToString)

           End If
       Next item


   End Sub
End Class

وناديت عليه بهذا لكن يظهر خطأ

Git_groups_facebook.Class1.post(WebBrowser1, CheckedListBox1)
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
[تم الحل] مشكلة فى تحويل هذا الكود الى كلاس - بواسطة ابو روضة - 10-04-19, 05:04 PM


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


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