Newsgroups: microsoft.public.it.dotnet.vb
From: "Marco Barzaghi" <marco.barzaghi_TOGLIQUESTASTRI...@gsol.it>
Date: Thu, 20 May 2004 13:55:55 +0200
Local: Thurs, May 20 2004 7:55 am
Subject: Re: combo box con più colonne
> come faccio a visualizzare più colonne dello stesso record in una combo? 1. definisco una classe per la formattazione degli Item > tipo | Nome | Cognome | --- Dim mValue As Object Public Sub New(ByVal v As Object, ByVal d As String) Public ReadOnly Property Value() As Object Public ReadOnly Property Description() As String End Class 2. Implemento una funzione di utilità che mi aiuta a caricare la combo. --- Dim list As New ArrayList Dim row As DataRow Dim values(displayMembers.Length) As Object Dim description As String = String.Format(formatDisplay, list.Add(New ItemFormatter(value, description)) Next Combo.DataSource = list End Sub 3. testare è sempre una buona abitudine :-p Dim dt As New DataTable dt.Rows.Add(New Object() {1, "Marco", "Barzaghi"}) FillCombo(ComboBox1, dt, "ID", "{0} | {1}", "Nome", "Cognome") Se invece di avere una datatable hai una collezione tipizzata devi usare HTH M.rkino -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||