Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

listview display

Status
Not open for further replies.

231166

Programmer
Apr 5, 2005
104
FR
Hi,


I have created a which contains terms in alphabetical order.

Now i would like to give a user to see this same list but for each term i would like to see all the made-up terms of the list which contain this term.

For example in the alphabetical list i have

agriculture


agriculture problems

basket


company


doctor


evil


force


gardian



happy


hydrolic agriculture


intensive agriculture



interest



joke


In the new presentation i would like to see this


agriculture

[blue]agriculture problems[/blue]

[blue]hydrolic agriculture[/blue]

[blue]intensive agriculture[/blue]


[green]agriculture problems[/green]

basket


company


doctor


evil


force


gardian



happy


[green]hydrolic agriculture[/green]


[green]intensive agriculture[/green]



interest



joke


Could you help me to have such a presentation of the terms of the TERMES table.

I have to precise that for each term, i need to see first the made-up terms which present the term agriculture first, and after, to see all the made-up terms which present the term agriculture it the end.

like this :

agriculture

agriculture problems : the term 'agriculture' is in first position in the made up term ' agriculture problems'

hydrolic agriculture : the term 'agriculture' is positionned at the end of the term 'hydrolic agriculture'

intensive agriculture : it is the same as for 'hydrolic agriculture'.

Other information :
-all the terms are in a table called TERMES ; there is no difference between made -up terms and not made-up terms : all of them are in a same table TERMES
-even if i find one made-up term(like hydrolic agriculture) after the term agriculture problem, i have to find it again in the alphaetical list : you can see this in colour green

If you could advice me on this problem it would be very kind from you.

Here is the code i use to create the display of the alphabetical list of terms in the listview1

Code:
 strSQLTERMES = "SELECT * FROM TERMES  where ID_THES = " & intNumThes.ToString & " ORDER BY Lib_TERME;"

objDA = New SqlDataAdapter(strSQLTERMES, objConn)
                objDA.Fill(objDS, "TERMES")

 With ListView1
                    .View = View.Details
                    .Columns.Clear()
                    .Columns.Add("Liste alphabétique des termes", ListView1.Width - 30, HorizontalAlignment.Left)
                    .Activation = ItemActivation.OneClick
                    .MultiSelect = False
                    .BackColor() = Color.LightCyan
                End With

                'On remplit la listview avec tous les termes de la table TERMES 
                For Each drTerme In objDS.Tables("TERMES").Rows
         If IsDBNull(drTerme.Item("EM")) = False Then
              If CType(drTerme.Item("EM"), Integer) = 0 Then
                            li = ListView1.Items.Add(Convert.ToString(drTerme.Item("Lib_TERME")))
                            With li
                                .ForeColor() = Color.Indigo
                                .Tag = drTerme("ID_TERME")
                                .Font = New Font("Helvetica", 10)
                            End With
                                    li = ListView1.Items.Add(" ")
                        Else
                            li = ListView1.Items.Add(Convert.ToString(drTerme.Item("Lib_TERME")) & "*ND*")
                            With li
                                .ForeColor = Color.DeepPink
                                .Tag = drTerme("ID_TERME")
                                .Font = New Font("Helvetica", 10)
                            End With
                                                 
 li =      ListView1.Items.Add(" ")
                        End If
                    End If
                Next

Thanks a lot for your help.

Best regards.

Nathalie





 
Sorry but it tolk me along time to understand what you are trying to do and i still may not get it:)

If i'm right then,
You want to have the real items at the top and fake at the bottom?
If so then you could create an extra column as the first (index=0) in the listview that has its width set to 0 (hidden), and put the EM value (if this is the value that indicates real items).
Then when you want to show the real items at the top, you use:
MyListView.Sort()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top