Click here to Skip to main content
15,891,253 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to dynamically use C# 3.5 compiler Pin
pbalaga23-Sep-09 23:48
pbalaga23-Sep-09 23:48 
GeneralRe: How to dynamically use C# 3.5 compiler Pin
PIEBALDconsult24-Sep-09 4:35
mvePIEBALDconsult24-Sep-09 4:35 
GeneralRe: How to dynamically use C# 3.5 compiler Pin
pbalaga24-Sep-09 7:06
pbalaga24-Sep-09 7:06 
GeneralRe: How to dynamically use C# 3.5 compiler Pin
PIEBALDconsult24-Sep-09 7:08
mvePIEBALDconsult24-Sep-09 7:08 
QuestionHow to make a Custom Textbox Controll caputure the Parent's clickEvent [modified] Pin
Natural_Demon23-Sep-09 9:35
Natural_Demon23-Sep-09 9:35 
AnswerRe: How to make a Custom Textbox Controll caputure the Parent's clickEvent Pin
DaveyM6923-Sep-09 10:20
professionalDaveyM6923-Sep-09 10:20 
GeneralRe: How to make a Custom Textbox Controll caputure the Parent's clickEvent Pin
Natural_Demon23-Sep-09 10:47
Natural_Demon23-Sep-09 10:47 
GeneralRe: How to make a Custom Textbox Controll caputure the Parent's clickEvent Pin
Natural_Demon23-Sep-09 11:12
Natural_Demon23-Sep-09 11:12 
this is the whole class

somehow 'SendMessage(...)' blocks it.
move the 'MessageBox' 2 lines higher @ 'protected override void OnHandleCreated' and it gets triggered.
put it baack below and it doesn't


public partial class exTextBox : TextBox
{
public exTextBox()
{
SendMessage(this.Handle, EM_SETCUEBANNER, 0, this.WaterMarkText);
}

protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
//this.Parent.Click +=new EventHandler(Parent_Click);
Parent.Click += new EventHandler(Parent_Click);
// just for testing
MessageBox.Show(
"OnHandleCreated",
"OnHandleCreated",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}

void Parent_Click(object sender, EventArgs e)
{
MessageBox.Show(
"click",
"click",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}

#region Attributes

//[DefaultValue(typeof(String), "set the default value"), Category("Appearance"), Description("Set the default value.")]

private const int EM_SETCUEBANNER = 0x1501;

[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern Int32 SendMessage
(IntPtr hWnd, int msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);

private string _waterMarkText = "Water Mark";
public string WaterMarkText
{
get { return _waterMarkText; }
set
{
SendMessage(this.Handle, EM_SETCUEBANNER, 0, value);
_waterMarkText = value;
Invalidate();
}
}
#endregion

public bool notempty()
{
if ((this.TextLength > 0) && (this.Text != this.WaterMarkText))
{
base.BackColor = Color.White;
return true;
}
else
{
base.BackColor = Color.Red;
this.Text = this.WaterMarkText;
return false;
}
}
}

Bad = knowing 2 much

QuestionHow to display Multiple images in crystal report Pin
me_ariharan23-Sep-09 8:49
me_ariharan23-Sep-09 8:49 
AnswerRe: How to display Multiple images in crystal report Pin
Abhishek Sur23-Sep-09 10:35
professionalAbhishek Sur23-Sep-09 10:35 
QuestionError when opening demo projects Pin
Stieven23-Sep-09 8:26
Stieven23-Sep-09 8:26 
AnswerRe: Error when opening demo projects Pin
Luc Pattyn23-Sep-09 10:13
sitebuilderLuc Pattyn23-Sep-09 10:13 
GeneralRe: Error when opening demo projects Pin
Stieven23-Sep-09 10:21
Stieven23-Sep-09 10:21 
GeneralRe: Error when opening demo projects Pin
Luc Pattyn23-Sep-09 10:37
sitebuilderLuc Pattyn23-Sep-09 10:37 
GeneralRe: Error when opening demo projects Pin
Stieven24-Sep-09 1:37
Stieven24-Sep-09 1:37 
Questionstring is not recognized Pin
Rabia_Arif23-Sep-09 7:40
Rabia_Arif23-Sep-09 7:40 
AnswerRe: string is not recognized Pin
PIEBALDconsult23-Sep-09 7:48
mvePIEBALDconsult23-Sep-09 7:48 
AnswerRe: string is not recognized Pin
Ian Shlasko23-Sep-09 8:41
Ian Shlasko23-Sep-09 8:41 
GeneralRe: string is not recognized Pin
PIEBALDconsult23-Sep-09 12:23
mvePIEBALDconsult23-Sep-09 12:23 
AnswerRe: string is not recognized Pin
Ashfield23-Sep-09 8:56
Ashfield23-Sep-09 8:56 
GeneralRe: string is not recognized Pin
DaveyM6923-Sep-09 9:07
professionalDaveyM6923-Sep-09 9:07 
GeneralRe: string is not recognized Pin
PIEBALDconsult23-Sep-09 12:12
mvePIEBALDconsult23-Sep-09 12:12 
GeneralRe: string is not recognized Pin
Luc Pattyn23-Sep-09 13:14
sitebuilderLuc Pattyn23-Sep-09 13:14 
GeneralRe: string is not recognized Pin
PIEBALDconsult23-Sep-09 17:55
mvePIEBALDconsult23-Sep-09 17:55 
GeneralRe: string is not recognized Pin
Luc Pattyn24-Sep-09 0:27
sitebuilderLuc Pattyn24-Sep-09 0:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.