Wednesday, 15 May 2013

c# - Why when adding dll file from Class Library project i'm getting error: Error on error Provider1? -



c# - Why when adding dll file from Class Library project i'm getting error: Error on error Provider1? -

i used website illustration of creating custom command in thiscase textbox:

custom control

in class library project built project , have dll file. in windows forms project on took box did take items when select dll file see added dll files list don't see violet sign near it:

this screenshot of windows forms project when added dll file.

on left dll after loaded called: extdtextbox on it's left near there no violet sign.

then in form1 designer see textbox after dragging it.

and on right on solution explorer on bottom see error i'm getting:

error on errorproviler1

this class added class library project:

using system; using system.collections.generic; using system.linq; using system.text; using system.windows.forms; using system.componentmodel; using system.drawing; namespace customcontrol { public class extdtextbox : textbox { #region fellow member variables color watermarkcolor = color.gray; color forecolor; font font; font watermarkfont; string watermarktext = "your text here"; #endregion #region constructor public extdtextbox() { base.text = this.watermarktext; this.forecolor = this.forecolor; this.forecolor = this.watermarkcolor; this.font = this.font; //event handlers this.textchanged += new eventhandler(extdtextbox_textchanged); this.keypress += new keypresseventhandler(extdtextbox_keypress); this.lostfocus += new eventhandler(extdtextbox_textchanged); } #endregion #region event handler methods void extdtextbox_textchanged(object sender, eventargs e) { if (!string.isnullorempty(this.text)) { this.forecolor = this.forecolor; this.font = this.font; } else { this.textchanged -= new eventhandler(extdtextbox_textchanged); base.text = this.watermarktext; this.textchanged += new eventhandler(extdtextbox_textchanged); this.forecolor = this.watermarkcolor; this.font = this.watermarkfont; } } void extdtextbox_keypress(object sender, keypresseventargs e) { string str = base.text.replace(this.watermarktext, ""); this.textchanged -= new eventhandler(extdtextbox_textchanged); this.text = str; this.textchanged += new eventhandler(extdtextbox_textchanged); } #endregion #region user defined properties /// <summary> /// property set/get watermark color @ design/runtime /// </summary> [browsable(true)] [category("extended properties")] [description("sets watermark color")] [displayname("watermark color")] public color watermarkcolor { { homecoming this.watermarkcolor; } set { this.watermarkcolor = value; base.ontextchanged(new eventargs()); } } [browsable(true)] [category("extended properties")] [description("sets textbox text")] [displayname("text")] /// <summary> /// property text @ runtime(hides base of operations text property) /// </summary> public new string text { { //required validation text property homecoming base.text.replace(this.watermarktext, string.empty); } set { base.text = value; } } [browsable(true)] [category("extended properties")] [description("sets watermark font")] [displayname("watermark font")] /// <summary> /// property text @ runtime(hides base of operations text property) /// </summary> public font watermarkfont { { //required validation text property homecoming this.watermarkfont; } set { this.watermarkfont = value; this.ontextchanged(new eventargs()); } } /// <summary> /// property set/get watermark text @ design/runtime /// </summary> [browsable(true)] [category("extended properties")] [description("sets watermark text")] [displayname("watermark text")] public string watermarktext { { homecoming this.watermarktext; } set { this.watermarktext = value; base.ontextchanged(new eventargs()); } } #endregion } }

the class library project in website illustration created new project under c# > windows > windows forms command library

.net 4.5 since windows forms project want add together dll .net 4.5

it's not error; it's property named error provided errorprovider component. component lets associate error message control.

c# .net winforms

No comments:

Post a Comment