Hi
I have below code & i want to save it in d Drive
C#
Bitmap qrCodeImage = GenerateQRCode(qrData);
qrCodeImage.Save("QRCode.png", System.Drawing.Imaging.ImageFormat.Png);Thanks
Hi
I have below code & i want to save it in d Drive
Bitmap qrCodeImage = GenerateQRCode(qrData);
qrCodeImage.Save("QRCode.png", System.Drawing.Imaging.ImageFormat.Png);Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Alpesh ManiyaRank #832 · 2.7K reputationPosted Jan 25, 2024, 1:55 AM EST
If you want to save the generated
qrCodeImageto the D drive, you can specify the complete path in theSavemethod. Here's an example:using System.IO; // ... Bitmap qrCodeImage = GenerateQRCode(qrData); // Specify the directory and file name using Path.Combine for platform independence string directory = @"D:\"; string fileName = "QRCode.png"; string filePath = Path.Combine(directory, fileName); // Save the image to the specified path qrCodeImage.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);In this example,
Path.Combineis used to create the complete file path by combining the directory ("D:\") and the file name ("QRCode.png"). This ensures that the code is platform-independent and works correctly on different operating systems.Jithu ThomasRank #437 · 5.7K reputationPosted Jan 25, 2024, 4:41 AM EST
using System.Drawing;
// Assuming GenerateQRCode() is a method that returns a Bitmap
// Generate QR code
Bitmap qrCodeImage = GenerateQRCode(qrData);
// Specify the full path on the D drive
string filePath = @"D:\QRCode.png";
// Save the QR code image to the specified path
qrCodeImage.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);