We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Trouble with images in ComboBoxAdv

By the way, here is the ICONImagelist contents...


11 Replies

RA Ralph August 12, 2019 11:17 AM UTC

Hi.. I've been round and round this for a couple of days.. googled it to death and can't seem to make any headway.

So I'm working in a VB.Net application using WinForms and am trying to implement a ComboBoxAdv with images. I want to populate it from a datatable loaded from a database.

The code I am using is below. It's pretty simple: work through the datatable which provides all the rows needed. There is a column called BMP which contains a byte array of the image. I can confirm that after the first loop the imagelist has 5 images in it and I have checked the images and they are perfect.

I then populate the ComboBox items with the items and assign images.

The result is all the items are there, there is space for the images, but the images themselves are missing!

:-/

Can anyone please give me a quick view as to what on earth my stupid mistake is?

The images, btw, are png format even though the column name is "BMP". These images are used all over the place in the application (for example in toolstrip context menus) very successfully. I have tried actual BMP format too and that's not helpful.

        Dim TechIcon As Image, BA As Byte(), TechName As String=""
        With Me.TechnologyToChoose
            .Items.Clear()
            .ShowImagesInComboListBox = True
            .ShowImageInTextBox = True
            .TextBoxHeight = 20
            .FlatBorderColor = SystemColors.Control
            Using ICONimagelist As ImageList = New ImageList
                'Populate the image list
                For Each rs In DT_Techs.Select("", "[Technology Name]")
                    BA = NZ(rs("BMP"), Nothing)
                    'if the DB doesn't contain an image, use a default
                    If BA IsNot Nothing Then
                        Using mStream As New System.IO.MemoryStream(BA)
                            TechIcon = System.Drawing.Image.FromStream(mStream)
                        End Using
                    Else
                        TechIcon = My.Resources.Technology
                    End If
                    'add it to the image list
                    ICONimagelist.Images.Add(rs("Technology Name"), TechIcon)
                Next

                '*** verified that image list has 5 images in it and verified that they are correct

                'Set the control's image list
                .ImageList = ICONimagelist
                'Populate the control
                For Each rs In DT_Techs.Select("", "[Technology Name]")
                    TechName = CStr(rs("Technology Name"))
                    .Items.Add(TechName)
                    .ItemsImageIndexes.Add(New Syncfusion.Windows.Forms.Tools.ComboBoxAdv.ImageIndexItem(Me.TechnologyToChoose,TechName,ICONimagelist.Images.IndexOfKey(TechName)))
                Next

            End Using
        End With

Here's a sample of the ICONimagelist for further information..



ON Olety Nikhilesh Olety Nagendra Syncfusion Team August 14, 2019 01:45 AM UTC

Hi Ralph, 
  
Thank you for contacting Syncfusion support. 
  
Based on the provided information, currently we are analyzing the issue “Trouble with images in ComboBoxAdv”. We will validate and let you know the details in one business day (August 14, 2019). We appreciate your patience until then. 
  
Regards, 
Nikhilesh O 



RA Ralph August 14, 2019 08:25 AM UTC

By the way, one additional attempt involved removing the :

"Using ICONimagelist As ImageList = New ImageList"
"End Using"

and replacing it with a private class-wide variable

Private ICONimagelist As ImageList = New ImageList

I had wondered if the imagelist implicit dispose (using-end using) was causing problems and that it needed to survive after the set procedure exited, but that has not changed the outcome. I also tried a "public" declaration in case there was a weird scope thing but still no go.

Cheers, RJ

Thanks, Ralph


JP Jagadeesan Pichaimuthu Syncfusion Team August 14, 2019 09:38 AM UTC

Hi Ralph, 
 
Thank you for your patience. 
 
We could able to reproduce the reported issue “The result is all the items are there, there is space for the images, but the images themselves are missing” and logged a bug report for this. We will fix this and will provide a fix patch on August 22nd, 2019. 
 
We appreciate your patience until then. 
 
Regards, 
Jagadeesan 



RA Ralph August 14, 2019 10:52 AM UTC

woohoo!!! found a bug!  and I'm a syncfusion newbie  :)

Thanks. I love it when people find bugs in my software- a) it proves I'm human after all and b) I can kill the bug and take a step closer to perfection.

Thanks for the update, looking forward to the fix.

Cheers, Ralph


DB Dinesh Babu Yadav Syncfusion Team August 15, 2019 06:03 AM UTC

Hi Ralph, 
 
Thanks for the update. We will update you once the release is roll out and will appreciate your patience until then. 
 
Regards, 
Dinesh Babu Yadav 



JP Jagadeesan Pichaimuthu Syncfusion Team August 22, 2019 12:33 PM UTC

Hi Ralph, 
 
Thank you for your patience. 
 
We have fixed the reported issues “The result is all the items are there, there is space for the images, but the images themselves are missing” and patch for it can be downloaded from below. 
 
Recommended approach – exe will perform automatic configuration         
Please find the patch setup here:      
 
Advanced approach – use only if you have specific needs and can directly replace existing assemblies for your build environment                          
Please find the patch assemblies alone from:    
    
Please find the Nugets from the below location:       
 
   
Assembly Version: 17.2.0.34 
Installation Directions:    
This patch should replace the files “Syncfusion.Tools.Windows” under the following folder.    
$system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version#\4.6  
Eg : $system drive:\Program Files\Syncfusion\Essential Studio\17.2.0.34\precompiledassemblies\17.2.0.34\4.6  
     
To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you will have to manually copy and paste them to the preferred location or you will have to run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies.    
     
Note: To change how you receive bug fixes, ask your license management portal admin to change your project’s patch delivery mode.    
     
     
Disclaimer: If you have received other patches for the same version for other products, please apply all patches in the order received. Please note that we have created this patch for version 17.2.0.34 specifically to resolve the following issue reported in the forum 146635.  
 
Regards, 
Jagadeesan 



RA Ralph August 23, 2019 03:03 PM UTC

thank you.. that works perfectly.

Cheers!

Ralph


JP Jagadeesan Pichaimuthu Syncfusion Team August 26, 2019 05:21 AM UTC

Hi Ralph, 
 
Thanks for the update. 
 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you. 
 
Regards, 
Jagadeesan 



RA Ralph August 27, 2019 06:29 AM UTC

My only comment concerns how the example for the ComboBoxAdv is framed. I have seen lots of questions and confusion - but you could clear it up with the way you give examples on your website. At this location:

https://help.syncfusion.com/windowsforms/comboboxadv/comboboxadv-appearance#image-in-textbox

You give these examples:
Me
.comboBoxAdv1.ImageList = Me.imageList1

Me
.comboBoxAdv1.ItemsImageIndexes.Add(New Syncfusion.Windows.Forms.Tools.ComboBoxAdv.ImageIndexItem(Me.comboBoxAdv1, "Pointer", 0))


The cause of the confusion is that in this example you don't show how to add an image to an
existing item..
So i wonder if this example could be helpful to newbies:



Dim ComboBoxAdvItem = ComboBoxAdv1.Items.Add("Pointer")
'OR

Dim ComboBoxAdvItem = ComboBoxAdv1.Items("Pointer")
ComboBoxAdv1.ItemsImageIndexes(ComboBoxAdvItem) = New Syncfusion.Windows.Forms.Tools.ComboBoxAdv.ImageIndexItem(ComboBoxAdv1,"Pointer",ImageListIndex)


Anyway, thanks for your help.





JP Jagadeesan Pichaimuthu Syncfusion Team August 27, 2019 11:55 AM UTC

Hi Ralph, 
 
Thanks for your valuable suggestion. 
 
We will consider your suggestion and make the necessary changes in our documentation in our upcoming release. 
 
Let us know whether this helps also if you need any further assistance on this. 
 
Regards, 
Jagadeesan 


Loader.
Live Chat Icon For mobile
Up arrow icon