Skip to main content
Email Password   helpLost your password?

Introduction

CueProvider is a tiny class that lets you set a cue banner (the grey prompt text that automatically disappears when you begin to type) in a TextBox control.

CueProvider demo

How to use CueProvider

CueProvider is easy to use, and has just two methods - one to set a TextBox's cue text, the other to clear it. To set the cue text, call SetCue(); to clear it, call ClearCue(). These calls are best placed in your form's OnLoad handler.

  // Set cue text
  CueProvider.SetCue (theTextBox, theCueText);

  // Clear cue text
  CueProvider.ClearCue (theTextBox);

How it works

CueProvider works by sending the TextBox the EM_SETCUEBANNER message. The message is sent using the SendMessage() Win32 API. More information on the EM_SETCUEBANNER message can be found on this MSDN page.

Conclusion

As you can see, there's nothing overly complicated in this class. I put CueBanner together in a few minutes, and wanted to share it with the CodeProject community in the hope it could help give our desktop apps a bit of UI "polish".

Revision history

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralCueProvider and MaskedTextBox Pin
zonextrem
4:47 12 Aug '08  
GeneralRe: CueProvider and MaskedTextBox Pin
Ravi Bhavnani
9:16 12 Aug '08  
GeneralRe: CueProvider and MaskedTextBox Pin
zonextrem
9:19 12 Aug '08  
GeneralRe: CueProvider and MaskedTextBox Pin
Ravi Bhavnani
9:22 12 Aug '08  
GeneralDemo not working :( Pin
baruchl
23:22 28 Jul '08  
AnswerRe: Demo not working :( Pin
Ravi Bhavnani
2:46 29 Jul '08  
GeneralRe: Demo not working :( Pin
TobiasP
4:41 30 Jul '08  
GeneralRe: Demo not working :( Pin
Ravi Bhavnani
4:48 30 Jul '08  
GeneralNot working!!! Pin
Qing Jiang
5:52 25 Jul '08  
GeneralRe: Not working!!! Pin
Ravi Bhavnani
7:39 25 Jul '08  
Generalnot workin Pin
pro.rakesh
0:58 25 Jul '08  
GeneralRe: not workin Pin
Ravi Bhavnani
7:40 25 Jul '08  
GeneralI modified it to do an IExtenderProvider component [modified] Pin
Fabrice CARUSO
21:11 24 Jul '08  
GeneralRe: I modified it to do an IExtenderProvider component Pin
Ravi Bhavnani
7:39 25 Jul '08  
GeneralA few suggestions... Pin
Scott Dorman
18:11 24 Jul '08  
GeneralRe: A few suggestions... Pin
Ravi Bhavnani
7:38 25 Jul '08  
GeneralRe: A few suggestions... Pin
Scott Dorman
15:19 25 Jul '08  
GeneralRe: A few suggestions... Pin
Ravi Bhavnani
20:21 25 Jul '08  
GeneralNot working... Pin
henur
7:59 22 Jul '08  
GeneralRe: Not working... Pin
Ravi Bhavnani
8:51 22 Jul '08  
GeneralRe: Not working... Pin
henur
22:48 22 Jul '08  
GeneralRe: Not working... Pin
Ravi Bhavnani
7:55 23 Jul '08  
AnswerRe: Not working... Pin
Ravi Bhavnani
12:52 24 Jul '08  
GeneralRe: Not working... Pin
henur
22:12 26 Jul '08  
GeneralRe: Not working... Pin
Ravi Bhavnani
8:26 27 Jul '08  


Last Updated 24 Jul 2008 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009