تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[سؤال] ترتيب القيم تصاعديا ضمن الليست فيو ؟
#6
السلام عليكم
بعد صبر وبحث ..........وفقت والحمد لله على ايحاد حل لفرز القيم
بعد ان تم قراءة شرح مفصل عن الاداة Listview
في منتدى الفريق العربي للبرمجة للاخ Sniper

يتم عن طريق كتابة
كود :
Sub PopulateListView()

        With ListView1
            .Clear()
            .View = View.Details
            .Columns.Add("Area_id", 0, HorizontalAlignment.Center)
            .Columns.Add("اســـم المنطقـــة", 372, HorizontalAlignment.Left)

            .GridLines = False
            .FullRowSelect = True
            .Cursor = Cursors.Hand
            .BackColor = System.Drawing.ColorTranslator.FromHtml(My_back_Color_Listview)
            .ForeColor = Color.Black

            Dim Lst As New ListViewItem
            Dim List = From B In db.Fixed_Areas Select B
            For Each x In List
                Lst = New ListViewItem(x.Area_id)
                Lst.SubItems.Add(x.Area)
                .Items.Add(Lst)
            Next
        End With

        ListView1.Sorting = SortOrder.Ascending
        ListView1.ListViewItemSorter = New ListViewItemComparer(1)
        ListView1.Sort()

    End Sub

ويتم انشاء كلاس، يتم وضع فيه
كود :
Public Class ListViewItemComparer
    Implements IComparer
    Private col As Integer

    Public Sub New()
        col = 0
    End Sub

    Public Sub New(ByVal column As Integer)
        col = column
    End Sub

    Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements IComparer.Compare
        Return [String].Compare(CType(x, ListViewItem).SubItems(col).Text, CType(y, ListViewItem).SubItems(col).Text)
    End Function

End Class


الملفات المرفقة صورة/صور
   
الرد }}}
تم الشكر بواسطة: sooriaty03 , @@أبورائد@@


الردود في هذا الموضوع
RE: ترتيب القيم تصاعديا ضمن الليست فيو ؟ - بواسطة kafi2030 - 13-10-13, 11:52 PM


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


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