metrick Active Member Licensed User Longtime User Oct 27, 2013 #1 How to change label.color via csv file? I have tried following code not working. Any input would be appreciated. Thanks. B4X: dim strColorName as string strColorName = ParseColorName(",", CSVtextfile, 2) 'CSVtextFile contained white, black, blue, yellow, red. etc. 'strColorName = "Blue" strColorName = "Colors." & strColorName Label1.Color = strColorName
How to change label.color via csv file? I have tried following code not working. Any input would be appreciated. Thanks. B4X: dim strColorName as string strColorName = ParseColorName(",", CSVtextfile, 2) 'CSVtextFile contained white, black, blue, yellow, red. etc. 'strColorName = "Blue" strColorName = "Colors." & strColorName Label1.Color = strColorName
Erel B4X founder Staff member Licensed User Longtime User Oct 28, 2013 #2 You will need to store the colors actual value, not name. Another option is to create a Map: B4X: Dim colorsMap As Map colorsMap.Initialize colorsMap.Put("white", Colors.White) colorsMap.Put("black", Colors.Black) ... Label1.Color = colorsMap.Get(strColorName) Upvote 0
You will need to store the colors actual value, not name. Another option is to create a Map: B4X: Dim colorsMap As Map colorsMap.Initialize colorsMap.Put("white", Colors.White) colorsMap.Put("black", Colors.Black) ... Label1.Color = colorsMap.Get(strColorName)
metrick Active Member Licensed User Longtime User Oct 29, 2013 #3 Thank you, Erel. I have created a routine to convert colors to actual value. Upvote 0