Click here to Skip to main content
14,978,617 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Not sure why it's not liking the last line in this:

    private void button1_Click_1(object sender, EventArgs e)
        {
            string QRCodeLocation = qrcodelocation.Text;
            QRCodeEncoder encoder = new QRCodeEncoder();
            Bitmap qrcode = encoder.Encode(QRCodeLocation);

Any help would be appreciated!

What I have tried:

rewriting the code but it's not making a difference
Posted
Updated 21-Oct-20 14:48pm

Bitmap qrcode = encoder.Encode(QRCodeLocation);

You are blindly trying to assign the qrcode value to whatever encoder is returning. I don't know the QrCodeEncoder code but clearly your encoder returns void type and thus forcing an assignment in above line will throw the error.

Remove the assignment as it is of void type. Go through their examples and see how to use if you are new to the library.
   
There's a CP article with code on QREncoder: [^]

Try this to help identify the error:
try
{
    Bitmap qrcode = encoder.Encode(QRCodeLocation);
}
catch (Exception ex)
{
    Console.WriteLine($"error: {ex.Message}");
}
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900