Wednesday, December 07, 2011

Creating QR code using ASP.NET form


Creating QR code using ASP.NET  form.

        string name = TextBox1.Text.ToString() + "\n";
        string age = TextBox2.Text.ToString() + "\n";
        string profession = TextBox3.Text.ToString();
        string s = name + age + profession;
        txt.Text = s;
        System.Net.WebClient client = new System.Net.WebClient();
        byte[] b = client.DownloadData("https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=" + txt.Text.ToString());

        Stream stream = new MemoryStream(b);
        System.Drawing.Bitmap bmb = new System.Drawing.Bitmap(stream);
        bmb.Save("C:\\windows\\3.png", ImageFormat.Png);
        stream.Dispose();
        stream.Flush();