منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
معرفة عدد صفحات قسم معين من المنتدى - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم اسئلة VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=183)
+--- الموضوع : معرفة عدد صفحات قسم معين من المنتدى (/showthread.php?tid=5308)



معرفة عدد صفحات قسم معين من المنتدى - فاتن - 06-10-12

اريد عند الدخول مثلاً لصفحة القسم يعطيني عدد الصفحات من 1 الى 4 مثلا
واريد التنقل فيما بينها ارجو منكم عمل لي مثال مع اداة الويب براوزير وان يتم التنقل بين الصفحات
مع العلم بان الرابط كالتالي سيكون
PHP كود :
http://vb4arab.com/vb/forumdisplay.php?f=134&pp=200&sort=lastpost&order=desc&page=1 

مع تغيير رقم 1 برقم الصفحة
مع العلم بانني قمت بطلب ذلك من مراقب المنتدى
Raggi Tech

وقال بانه سيطرح الحل بموضوع من قبل 4 ايام والى الان لم يطرحة

ارجو منكم الرد




معرفة عدد صفحات قسم معين من المنتدى - RaggiTech - 06-10-12

ههههههههههههههههههههههههههههههههههههههههههههههههههههههههههه :confused:
اخت فاتن تحياتي لك
ابلغت حضرتك اني لست متفرغا لطرح الحل هنا و حضرتك سألتيني اكثر من مره في الرسائل الخاصه و على رسائل الزوار و اعطيت حضرتك حل مؤقت

انا لدي الحل ولكن ليس عندي وقت كافي لطرحه باستفاضه الان
ان شاء الله احد من الاخوه الاعضاء يقدمو المساعدة المطلوبه
وشكراً لحضرتك



معرفة عدد صفحات قسم معين من المنتدى - فاتن - 06-10-12

يا ريت يا استاذي بدون مسخرة
وانا ما بدي اسحب مواضيع المنتدى انا بدي بس اتعلم على الاداة

ومثل ما حكيت في الاخوة الاعضاء بقدمو المساعدة وانتا عندك الحل بس مش فاضي :confused: تنسخه من جهازك للمنتدى بارك الله فيك


وكمان مرة بدون ضحك ما الو لزوووم

شكراً لمرورك المؤثر !!!


معرفة عدد صفحات قسم معين من المنتدى - RaggiTech - 06-10-12

اولا اسف للضحك ولكن انا لحظت ان حضرتك ركزتي على اني لم اساعد حضرتك اكثر من تركيز حضرتك على طلبك
ثانيا كنت احب ان اشرح الكود و لكن اليك الكود
كود :
Private Sub fpages()
كود :
[color=#000080][SIZE=2][FONT=tahoma][b] On Error Resume Next[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]        'لاتوجد مشاركات في هذا القسم.[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]        Dim search = "لاتوجد مشاركات في هذا القسم."[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]        Dim where = InStr(WB.Document.Body.InnerHtml, search)[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]        If where <= 0 Then[/b][/FONT][/SIZE][/color]

[color=#000080][SIZE=2][FONT=tahoma][b]            Dim Elems As HtmlElementCollection[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]            Dim WebOC As Windows.Forms.WebBrowser = WB[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]            Dim numpost As Integer = 0[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]            Elems = WebOC.Document.GetElementsByTagName("TD")[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]            For num = 0 To Elems.Count[/b][/FONT][/SIZE][/color]

[color=#000080][SIZE=2][FONT=tahoma][b]                If InStr(Elems.Item(num).InnerHtml, "vbmenu_control") Then[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                    If numpost = 0 Then[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                        Dim Testpage As String = Elems.Item(num).InnerHtml[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                        Dim MyOutput, MyOutput2 As String[/b][/FONT][/SIZE][/color]

[color=#000080][SIZE=2][FONT=tahoma][b]                        MyOutput = GetStringBetween(Testpage, "<TD style=" & Chr(34) & "FONT-WEIGHT: normal" & Chr(34) & " class=vbmenu_control>", "</TD>")[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                        text1.Text = MyOutput[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                        Dim x = InStr(text1.Text, "صفحة " & pagenum.Text & " من ")[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                        If x > 0 Then[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            text1.SelectionStart = x - 1[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            text1.SelectionLength = Len("صفحة " & pagenum.Text & " من ")[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            text1.SelectedText = ""[/b][/FONT][/SIZE][/color]

[color=#000080][SIZE=2][FONT=tahoma][b]                            lastpagenum.Text = text1.Text[/b][/FONT][/SIZE][/color]



[color=#000080][SIZE=2][FONT=tahoma][b]                            If pagenum.Text > 1 Then[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                                prevpage.Enabled = True[/b][/FONT][/SIZE][/color]

[color=#000080][SIZE=2][FONT=tahoma][b]                                If pagenum.Text = lastpagenum.Text Then[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                                    nextpage.Enabled = False[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                                ElseIf pagenum.Text < lastpagenum.Text Then[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                                    nextpage.Enabled = True[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                                End If[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            ElseIf pagenum.Text = 1 Then[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                                prevpage.Enabled = False[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                                nextpage.Enabled = True[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            End If[/b][/FONT][/SIZE][/color]

[color=#000080][SIZE=2][FONT=tahoma][b]                            pages.Text = "Page " & pagenum.Text & " OF " & lastpagenum.Text[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            getposts()[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            gb2.Enabled = True[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            pages.Left = 50[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                        Else[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            pages.Text = "Only One Page"[/b][/FONT][/SIZE][/color]

[color=#000080][SIZE=2][FONT=tahoma][b]                            pagenum.Text = "0"[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            lastpagenum.Text = "0"[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            nextpage.Enabled = False[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            prevpage.Enabled = False[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            getposts()[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            gb2.Enabled = True[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                        End If[/b][/FONT][/SIZE][/color]

[color=#000080][SIZE=2][FONT=tahoma][b]                        numpost = 1[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                    End If[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                End If[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]            Next[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]        End If[/b][/FONT][/SIZE][/color]

هذا الكود جزء من مشروع و سيأخذ جهد من حضرتك لكي تستوعبي ما هو عمل البرنامج
وهذا هو السبب اني لم اطرح الحل اني ليس لدي وقت لتوضيح الفكره كامله وتركت الموضوع للاخوه الاعضاء

واسف لحضرتك مره ثانية
وشكراً

ملاحظه : انا مجرد مبتدئ في البرمجه و ليس بالضروري اني مراقب منتدى فاكن محترف في البرمجه الرقابه ما هي الا متابعة المواضيع والمساعدة قدر الامكان

واسف لحضرتك مره ثالثه

تحياتي لك
مؤمن



معرفة عدد صفحات قسم معين من المنتدى - فاتن - 07-10-12

Raggi Tech كتب :اولا اسف للضحك ولكن انا لحظت ان حضرتك ركزتي على اني لم اساعد حضرتك اكثر من تركيز حضرتك على طلبك
ثانيا كنت احب ان اشرح الكود و لكن اليك الكود
كود :
Private Sub fpages()
كود :
[color=#000080][SIZE=2][FONT=tahoma][b] On Error Resume Next[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]        'لاتوجد مشاركات في هذا القسم.[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]        Dim search = "لاتوجد مشاركات في هذا القسم."[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]        Dim where = InStr(WB.Document.Body.InnerHtml, search)[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]        If where <= 0 Then[/b][/FONT][/SIZE][/color]

[color=#000080][SIZE=2][FONT=tahoma][b]            Dim Elems As HtmlElementCollection[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]            Dim WebOC As Windows.Forms.WebBrowser = WB[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]            Dim numpost As Integer = 0[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]            Elems = WebOC.Document.GetElementsByTagName("TD")[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]            For num = 0 To Elems.Count[/b][/FONT][/SIZE][/color]

[color=#000080][SIZE=2][FONT=tahoma][b]                If InStr(Elems.Item(num).InnerHtml, "vbmenu_control") Then[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                    If numpost = 0 Then[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                        Dim Testpage As String = Elems.Item(num).InnerHtml[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                        Dim MyOutput, MyOutput2 As String[/b][/FONT][/SIZE][/color]

[color=#000080][SIZE=2][FONT=tahoma][b]                        MyOutput = GetStringBetween(Testpage, "<TD style=" & Chr(34) & "FONT-WEIGHT: normal" & Chr(34) & " class=vbmenu_control>", "</TD>")[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                        text1.Text = MyOutput[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                        Dim x = InStr(text1.Text, "صفحة " & pagenum.Text & " من ")[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                        If x > 0 Then[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            text1.SelectionStart = x - 1[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            text1.SelectionLength = Len("صفحة " & pagenum.Text & " من ")[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            text1.SelectedText = ""[/b][/FONT][/SIZE][/color]

[color=#000080][SIZE=2][FONT=tahoma][b]                            lastpagenum.Text = text1.Text[/b][/FONT][/SIZE][/color]



[color=#000080][SIZE=2][FONT=tahoma][b]                            If pagenum.Text > 1 Then[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                                prevpage.Enabled = True[/b][/FONT][/SIZE][/color]

[color=#000080][SIZE=2][FONT=tahoma][b]                                If pagenum.Text = lastpagenum.Text Then[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                                    nextpage.Enabled = False[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                                ElseIf pagenum.Text < lastpagenum.Text Then[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                                    nextpage.Enabled = True[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                                End If[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            ElseIf pagenum.Text = 1 Then[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                                prevpage.Enabled = False[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                                nextpage.Enabled = True[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            End If[/b][/FONT][/SIZE][/color]

[color=#000080][SIZE=2][FONT=tahoma][b]                            pages.Text = "Page " & pagenum.Text & " OF " & lastpagenum.Text[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            getposts()[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            gb2.Enabled = True[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            pages.Left = 50[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                        Else[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            pages.Text = "Only One Page"[/b][/FONT][/SIZE][/color]

[color=#000080][SIZE=2][FONT=tahoma][b]                            pagenum.Text = "0"[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            lastpagenum.Text = "0"[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            nextpage.Enabled = False[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            prevpage.Enabled = False[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            getposts()[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                            gb2.Enabled = True[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                        End If[/b][/FONT][/SIZE][/color]

[color=#000080][SIZE=2][FONT=tahoma][b]                        numpost = 1[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                    End If[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]                End If[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]            Next[/b][/FONT][/SIZE][/color]
[color=#000080][SIZE=2][FONT=tahoma][b]        End If[/b][/FONT][/SIZE][/color]

هذا الكود جزء من مشروع و سيأخذ جهد من حضرتك لكي تستوعبي ما هو عمل البرنامج
وهذا هو السبب اني لم اطرح الحل اني ليس لدي وقت لتوضيح الفكره كامله وتركت الموضوع للاخوه الاعضاء

واسف لحضرتك مره ثانية
وشكراً

ملاحظه : انا مجرد مبتدئ في البرمجه و ليس بالضروري اني مراقب منتدى فاكن محترف في البرمجه الرقابه ما هي الا متابعة المواضيع والمساعدة قدر الامكان

واسف لحضرتك مره ثالثه

تحياتي لك
مؤمن



ردك كتير مشوش ولم يعمل معي.


معرفة عدد صفحات قسم معين من المنتدى - m.sami.ak - 07-10-12

بسم الله الرحمن الرحيم

تفضلي ست
فاتن الحل مرفق





PHP كود :
Imports System
Imports System
.IO
Imports System
.Data
Public Class Form1

    
Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Button1.Click
        Dim href 
As String
        Dim links 
As New Collection
        Dim NumPage 
As New ArrayList()
        
Dim cunter 0


        Wb
.Navigate(TextBox2.Text "&pp=200&sort=lastpost&order=desc")
        Do 
Until Wb.ReadyState WebBrowserReadyState.Complete
            My
.Application.DoEvents()
        
Loop


        
For Each link As HtmlElement In Wb.Document.Links
            href 
link.GetAttribute("href")

            If 
href.Contains("&pp=200&sort=lastpost&order=desc&page"Then



                Dim spliter
() As String
                spliter 
href.Split("=")

                
NumPage.Insert(cunterspliter(spliter.Length 1))
                
cunter += 1



            End 
If

        
Next
       

        Dim str 
= (NumPage.Item(NumPage.Count 1))    'Microsoft.VisualBasic.Right(NumPage.Item(NumPage.Count - 1), 1) 


        Dim strArr() As String
        strArr = str.Split("=")

        Dim xx = (strArr(strArr.Length - 1))



        For i As Integer = 1 To xx
            Me.TextBox1.Text &= TextBox2.Text & "&pp=200&sort=lastpost&order=desc&page=" & i & vbNewLine


        Next
    End Sub


    Public Function GetMaxValue(ByVal itemList As ArrayList)

        Dim max As Integer = Nothing

        For i As Integer = 0 To (itemList.Count - 1)
            If i = 0 Then
                max = itemList(i)
            Else
                If itemList(i) > max Then max = itemList(i)
            End If
        Next

        GetMaxValue = max

    End Function

End Class 



تحياتــــي للجميع
ابــــو ســـــامــــي





معرفة عدد صفحات قسم معين من المنتدى - m.sami.ak - 07-10-12

واذا اردتي لتحسين المظهر للفورم

ازيلي اداة ال webBrowser عن الفورم
وقومي بتعريف هذا تحت بداية تعريف الكلاس Dim wb As New WebBrowser


معرفة عدد صفحات قسم معين من المنتدى - RaggiTech - 07-10-12

شكراً اخي ابو سامي لتقديم المساعد و التوضيح