Click here to Skip to main content
15,886,648 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
I want to know how tu use the UserControl.I add an UserControl1.cs from the item list of the Add New Item-WindowsForm.The code of the document below:
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace WindowsForm
{
    public partial class UserControl1 : UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }
    }
}

Who can give me an exmaple for it and some document for UserControl.Thanks!
Posted

To Learn about UserControl you should Navigate the Given Link
User Control With C#[^]
 
Share this answer
 
Comments
Venkatesh Mookkan 28-Dec-10 23:38pm    
Good Answer
RaviRanjanKr 28-Dec-10 23:48pm    
Thanks Venkatesh
AngelLoose 29-Dec-10 19:45pm    
Thanks!It help me a lot!
http://msdn.microsoft.com/en-us/library/a6h7e207(v=VS.80).aspx[^]

This website is guide you how to create a UserControl
 
Share this answer
 
Combining controls that are found in the toolbox to create a composite control is possible with the user control.

This would create the .ascx file needed for the development of the user control. In the design view you can add two controls, namely a label and a textbox. And in the code view add the following code to set the properties for the label and the textbox.
public string propText
{
get { return TextBox1.Text; }
set { TextBox1.Text = value; }
}
public string propLbl
{
get { return Label1.Text; }
set { Label1.Text = value; }
}


Hope this will guide you.
 
Share this answer
 
v2
Comments
AngelLoose 29-Dec-10 19:46pm    
Thank you all the same

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