Overload resolution failed on BarCodeView

0 Answers 24 Views
BarcodeView
Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
Martin Hamilton asked on 10 Feb 2025, 05:25 PM | edited on 10 Feb 2025, 09:58 PM

I'm trying to get a barcodeview  routine working, but it keeps telling me that the Overload resolution fails - actually on every single (6) of them!

Would you mind looking at this code and letting me know what needs to be changed to get this to work?

    Private Sub GenerateBarCode()
        Dim RadBarcodeView1 As RadBarcodeView = New RadBarcodeView()
        RadBarcodeView1.Height = 10
        RadBarcodeView1.Width = 60
        Dim code39Extended1 As Telerik.WinControls.UI.Barcode.Symbology.Code39Extended = New Telerik.WinControls.UI.Barcode.Symbology.Code39Extended()
        RadBarcodeView1.Symbology = code39Extended1
        RadBarcodeView1.Value = "123456"
        RadBarcodeView1.LoadElementTree()
        Dim fileName As String = IO.Path.Combine(Application.StartupPath, $"{RadBarcodeView1.Value}.png")
        If IO.File.Exists(fileName) Then
            IO.File.Delete(fileName)
        End If
        Dim BarcodeSize As New Size(100, 10)
        Dim img As Image = RadBarcodeView1.ExportToImage(fileName, BarcodeSize, Imaging.ImageFormat.Png)
        img.Save(fileName, System.Drawing.Imaging.ImageFormat.Png)
    End Sub

Please refer to the attached image

Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
commented on 10 Feb 2025, 10:01 PM

Image

Dinko | Tech Support Engineer
Telerik team
commented on 12 Feb 2025, 01:12 PM

Thank you for the provided image and details. I don't think it is related to the overloads. Upon checking the ExportToImage() method source I noticed that using that version of the method which accepts Stream or string, the method does not return an Image. In that version it is void. The method returns image, when not passing any parameters or only passing the width and height of the exported image. Here are the collapsed version of the ExportToImage() method:

In your case, if you won't use the Image after it is exported in code, you can remove the code that saves the image using the Save() method and directly uses the ExportToImage() by passing the fileName. The internal code will save the image using the pass parameter. Here is what I have in mind to try:

Private Sub GenerateBarCode()
        Dim RadBarcodeView1 As RadBarcodeView = New RadBarcodeView()
        RadBarcodeView1.Height = 10
        RadBarcodeView1.Width = 60
        Dim code39Extended1 As Telerik.WinControls.UI.Barcode.Symbology.Code39Extended = New Telerik.WinControls.UI.Barcode.Symbology.Code39Extended()
        RadBarcodeView1.Symbology = code39Extended1
        RadBarcodeView1.Value = "123456"
        RadBarcodeView1.LoadElementTree()
        Dim fileName As String = IO.Path.Combine(Application.StartupPath, $"{RadBarcodeView1.Value}.png")
        If IO.File.Exists(fileName) Then
            IO.File.Delete(fileName)
        End If
        Dim BarcodeSize As New Size(100, 10)
        RadBarcodeView1.ExportToImage(fileName, BarcodeSize, Imaging.ImageFormat.Png)       
    End Sub

 

 

No answers yet. Maybe you can help?

Tags
BarcodeView
Asked by
Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
Share this question
or