Click here to Skip to main content
15,888,051 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi I need to create a dll and usercontrol.....
In usercontrol having textbox when i enter into the textbox corresponding textbox should change backcolor,forecolor and font as Bold......
Posted
Comments
Member 10339067 12-Dec-13 5:38am    
i need to create in c#.net
Member 10339067 12-Dec-13 5:44am    
i used following one:

namespace sttTextBox
{
public partial class UserControl1 : TextBox
{
public UserControl1()
{
InitializeComponent();
this.GotFocus += new EventHandler(UserControl1_GotFocus);
this.LostFocus += new EventHandler(UserControl1_LostFocus);
}

void UserControl1_LostFocus(object sender, EventArgs e)
{
this.BackColor = Color.White;
this.ForeColor = Color.Black;
}

void UserControl1_GotFocus(object sender, EventArgs e)
{
this.BackColor = Color.Aqua;
this.ForeColor = Color.Brown;
}
}
Member 10339067 12-Dec-13 5:44am    
but its not working
Mitchell J. 12-Dec-13 5:46am    
What is it doing instead? Nothing? Or is it acting but inconsistently?
BillWoodruff 12-Dec-13 6:45am    
There's nothing inherently wrong with your code.

The source of the error is whatever you are doing in Visual Studio to create the dll.

If you describe how you are creating the dll in Visual Studio, then I believe we can help you. Please give a detailed answer.

Create a new project in Visual Studio - but choose "Class Library", not "Windows Forms Application" or "WPF Application".

This project type can be used to create a .dll file.

When you have your project, add a new item of type "UserControl" to it. You'll then be able to customize your usercontrol by adding a textbox to it and writing whatever code you want for the textbox.

When you have finished, you will be able to find your control inside the .dll file.
 
Share this answer
 
Comments
Member 10339067 12-Dec-13 5:47am    
the above mentioned my codings are correct or not?
Member 10339067 12-Dec-13 5:48am    
sir i couldnt receive ur messages by code project... im seeing ur replies from my gmail account
Mitchell J. 12-Dec-13 5:51am    
Hello!
I tried your code...
Is the problem that the code does not compile?
Member 10339067 12-Dec-13 5:51am    
really i dont know about usercontrol help me.....
Mitchell J. 12-Dec-13 5:52am    
I'm afraid I can't see your screen or read your mind, though.
Ok...

Download this file www.dice.web44.net/ExampleWithTextbox.zip[^]

Yes it's one of my experimental websites.

That's probably all the help I should give you, because this is a quick answers section, not a free learn to program course... your question now seems to reveal a lack of very basic knowledge :-(

Good luck!
 
Share this answer
 
Comments
Member 10339067 12-Dec-13 6:30am    
Thank u so much
Mitchell J. 12-Dec-13 6:34am    
You're welcome!

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