Another use of the QRCode can be to store information added to the contact us page or a business card. This eliminates the need, for application users, to type or save the contact details manually. They can retrieve the details by simply scanning the code with their smartphone.
In Visual Studio, create a new ASP.Net Web Application and add a new Web Form. Then, complete the following steps:
Control Name | Property | Value |
---|---|---|
Label1 | Text | Smith Anderson |
Label2 | Text | ComponentOne |
Label3 | Text | Address: 203 New York Ave, New York, USA |
Label4 | Text | Ph: 1.800.858.2739 |
Label5 | Text | Fax: 1.800.858.2739 |
Label6 | Text | Email: Smith@componentone.com |
The form will appear somewhat as shown in the image below:
Following will be your code for the form, in the Source View, after you have added all controls and set all the properties:
Source View |
Copy Code
|
---|---|
<b> <asp:Label ID="Label1" runat="server" Text="Smith Anderson"></asp:Label></b> <p> <asp:Label ID="Label2" runat="server" Text="ComponentOne"></asp:Label><br /> <asp:Label ID="Label3" runat="server" Text="Address: 203 New York Ave, New York, USA"></asp:Label><br /> <asp:Label ID="Label4" runat="server" Text=" Ph: 1.800.858.2739"></asp:Label><br /> <asp:Label ID="Label5" runat="server" Text=" Fax: 1.800.858.2739"></asp:Label><br /> <asp:Label ID="Label6" runat="server" Text="Email: Smith@componentone.com"></asp:Label><br /> </p> <cc1:C1QRCode ID="C1QRCode1" runat="server" /> |
Add the following code to the Page_Load event, to generate the QRCode for the labels added to the form.
C# |
Copy Code
|
---|---|
C1QRCode1.Text = Label1.Text + '\n' + Label2.Text + '\n' + Label3.Text + '\n' + Label4.Text + '\n' + Label5.Text + '\n' + Label6.Text; |
VB |
Copy Code
|
---|---|
C1QRCode1.Text = Label1.Text + ControlChars.Lf + Label2.Text + ControlChars.Lf + Label3.Text + ControlChars.Lf + Label4.Text + ControlChars.Lf + Label5.Text + ControlChars.Lf + Label6.Text |
When you run the project, a QRCode containing the details of the business card is generated, as shown below:
When you scan the above QRCode, the reader will decode the following information:
Smith Anderson
ComponentOne
Address: 203 New York Ave, New York, USA
Ph: 1.800.858.2739
Fax: 1.800.858.2739
Email: Smith@componentone.com