passado Posted August 23, 2009 at 04:19 PM Report #284264 Posted August 23, 2009 at 04:19 PM Boas pessoal estou a querer mudar uma gridview para uma listview, o carregamento dos dados ja os consegui fazer bem como o resgate dos valores da linha seleccionada, a minha duvida agora é como posso colocar o tamanho das colunas automatico de acordo com o tamanho do texto contido nas celulas das colunas? Como posso criar um for deste genero: For row As Integer = 0 To DataGridView1.RowCount - 1 Dim inicio As DateTime inicio = Today Dim fim As DateTime fim = DataGridView1.Item(3, row).Value Dim dif As TimeSpan = fim.Subtract(inicio) Dim dias As Integer = dif.Days If dias = 3 Then With Me.DataGridView1.Rows(row).DefaultCellStyle .BackColor = Color.SpringGreen End With ElseIf dias = 2 Then With Me.DataGridView1.Rows(row).DefaultCellStyle .BackColor = Color.Green End With ElseIf dias = 1 Then With Me.DataGridView1.Rows(row).DefaultCellStyle .BackColor = Color.OrangeRed End With ElseIf dias <= 0 Then With Me.DataGridView1.Rows(row).DefaultCellStyle .BackColor = Color.Red .Font = New Font("Tahona", 12, FontStyle.Bold) End With End If Next Mas para listview, ou entao em vez de pintar as linhas criar uma coluna com uma certa imagem? Outra duvida e como ocultar colunas, eu ja consegui, mas se o utilizador for reajustar as colunas elas podem aparecer.... Alguem me consegue ajudar? Cumps
fLaSh_PT Posted August 27, 2009 at 10:33 AM Report #284717 Posted August 27, 2009 at 10:33 AM Vê este project sample que criei ja algum tempo.. http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=6388&lngWId=10 Que encontras um função que preenche uma listview com um query.. Making the impossible possible and pwing the world on db at a time.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now