This article explains how to make your own custom control in C#. Here in this example I will make a Login Control. To do that open Visual Studio then select "File" -> "New" -> "Project..." then select Windows Forms Control Library.Image 1.Now I design my control with User Id and Password Label and Text Box.Image 2.The following is my login control code:
Now compile and run this app.Image 3Here click on Load and copy the DLL path.Image 4.Now create a new Windows application.Open Visual Studio then select "File" -> "New" -> "Project..." then select Windows Application.Image 5.Here select View-> Toolbox then right-click anywhere and select "Choose Items...".Image 6.A popup window will open. Click on Browse.Image 7.Go to the User Control DLL location (we copied the DLL path earlier). Select the DLL then click Open.Image 8.Now you can see your control then click OK.Image 9.Now go to your form. See that the control is displaying in the tool box. Drag and drop this control on the form.Image 10.Now for the code part of this form.
Here I am authenticating User ID and Password from my SQL Table. Now run the application.If you don't enter an id and password and click on the Log In button then the following error message will appear.Image 11.Image 12.Image 13.The following is my data table design from which I am authenticating the user.Image 14.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: