Add multiple properties to ListView1

Post

Posted
Rating:
#1 (In Topic #1127)
Enthusiast
gambafeliz is in the usergroup ‘Enthusiast’
I have this line that works:

Code (gambas)

  1. ListView1.Add(resultado["ID"], resultado["Name"], Picture[$sNoMonitor]).Foreground = Color.RGB(255, 0, 125)
  2. ' ListView1.Add(resultado["ID"], resultado["Name"], Picture[$sNoMonitor]).RichText = "<b style='color:rgb(255,0,125);'>" & resultado["Nombre"] & "</b>"  (This works but I don't want to do it like this)
  3.  

But I want to add .Font.Bold = True but how would it be done if possible.

Thank you.

For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
Online now: No Back to the top

Post

Posted
Rating:
#2
Enthusiast
gambafeliz is in the usergroup ‘Enthusiast’
My solution:

Code (gambas)

  1.                With ListView1
  2.                   .Add(resultado["ID"], resultado["Name"], Picture[$sNoMonitor])
  3.                   .Foreground = Color.RGB(255, 0, 125) '.RichText = "<b style='color:rgb(255,0,125);'>" & resultado["Nombre"] & "</b>"
  4.                   .Font.Bold = True
  5.                End With  
  6.  

Note: (This solution does not work for the individual addition therefore it is not a valid solution. It is valid for all items)

For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
Online now: No Back to the top

Post

Posted
Rating:
#3
Guru
BruceSteers is in the usergroup ‘Guru’

gambafeliz said

My solution:

Code (gambas)

  1.                With ListView1
  2.                   .Add(resultado["ID"], resultado["Name"], Picture[$sNoMonitor])
  3.                   .Foreground = Color.RGB(255, 0, 125) '.RichText = "<b style='color:rgb(255,0,125);'>" & resultado["Nombre"] & "</b>"
  4.                   .Font.Bold = True
  5.                End With  
  6.  

Note: (This solution does not work for the individual addition therefore it is not a valid solution. It is valid for all items)

You're pretty close…
If you mix your 2 solutions together you will get this…

Code (gambas)

  1.                With ListView1.Add(resultado["ID"], resultado["Name"], Picture[$sNoMonitor])
  2.                   .Foreground = Color.RGB(255, 0, 125) '.RichText = "<b style='color:rgb(255,0,125);'>" & resultado["Nombre"] & "</b>"
  3.                   .Font.Bold = True
  4.                End With  
  5.  
Online now: No Back to the top

Post

Posted
Rating:
#4
Enthusiast
gambafeliz is in the usergroup ‘Enthusiast’
Thank you very much for your always effort. Thank you.

Code (gambas)

  1. With ListView1.Add(resultado["ID"], resultado["Name"], Picture[$sNoMonitor])
  2.    .Foreground = Color.RGB(255, 0, 125) '.RichText = "<b style='color:rgb(255,0,125);'>" & resultado["Nombre"] & "</b>"
  3.    .Font.Bold = True 'Here
  4.  

But right on the line that I indicated, the Subroutine is exited. As if an error occurred. I don't know what's happening yet. But this gives an error, when I do what you tell me, in fact I already tried it but since it failed me, I have left it, because it is impossible for the moment.

Note: Error.Code = 13 = Null object

For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
Online now: No Back to the top

Post

Posted
Rating:
#5
Guru
BruceSteers is in the usergroup ‘Guru’

gambafeliz said

Thank you very much for your always effort. Thank you.

Code (gambas)

  1. With ListView1.Add(resultado["ID"], resultado["Name"], Picture[$sNoMonitor])
  2.    .Foreground = Color.RGB(255, 0, 125) '.RichText = "<b style='color:rgb(255,0,125);'>" & resultado["Nombre"] & "</b>"
  3.    .Font.Bold = True 'Here
  4.  

But right on the line that I indicated, the Subroutine is exited. As if an error occurred. I don't know what's happening yet. But this gives an error, when I do what you tell me, in fact I already tried it but since it failed me, I have left it, because it is impossible for the moment.

Note: Error.Code = 13 = Null object

You are correct, the .Font property does not seem to be initialized , so accessing it's .Bold property throws an error.

So this works…

Code (gambas)

  1. With ListView1.Add(resultado["ID"], resultado["Name"], Picture[$sNoMonitor])
  2.    .Foreground = Color.RGB(255, 0, 125) '.RichText = "<b style='color:rgb(255,0,125);'>" & resultado["Nombre"] & "</b>"
  3.    .Font = ListView1.Font  ' initalize the Font property
  4.    .Font.Bold = True '  okay now
  5.  
Online now: No Back to the top

Post

Posted
Rating:
#6
Enthusiast
gambafeliz is in the usergroup ‘Enthusiast’
Thanks, it works perfectly.
You do know about Gambas programming.

That's if I painted the wall in my living room, maybe I wouldn't call you. :)

For your misfortunes I am Spanish and I only know Spanish, please, be patient with me, Thank you. :)
Online now: No Back to the top
1 guest and 0 members have just viewed this.