Click here to Skip to main content
15,885,244 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dll strange behavior C # Pin
equelna10-Aug-16 4:43
equelna10-Aug-16 4:43 
GeneralRe: Dll strange behavior C # Pin
Richard MacCutchan10-Aug-16 4:50
mveRichard MacCutchan10-Aug-16 4:50 
GeneralRe: Dll strange behavior C # Pin
equelna10-Aug-16 5:01
equelna10-Aug-16 5:01 
GeneralRe: Dll strange behavior C # Pin
Richard MacCutchan10-Aug-16 5:03
mveRichard MacCutchan10-Aug-16 5:03 
GeneralRe: Dll strange behavior C # Pin
equelna10-Aug-16 5:11
equelna10-Aug-16 5:11 
GeneralRe: Dll strange behavior C # Pin
Richard MacCutchan10-Aug-16 5:13
mveRichard MacCutchan10-Aug-16 5:13 
GeneralRe: Dll strange behavior C # [SOLVED] Pin
equelna10-Aug-16 6:33
equelna10-Aug-16 6:33 
QuestionImplementing a Cue Banner to a textbox in windows xp with custom color Pin
srikrishnathanthri9-Aug-16 21:41
srikrishnathanthri9-Aug-16 21:41 
Hello,
I am planning to implement cue banner for Text boxes in .net. I want this cue text to work till user enters some text in the box, that is cue text should not disappear if user clicks on text box.

I got this example, but I have two problems with this.
C#
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Runtime.InteropServices;

public class Form1
{

	private void Form1_Load(System.Object sender, System.EventArgs e)
	{
		CueBannerText.SetCueText(TextBox1, "Enter Name here");
	}
	public Form1()
	{
		Load += Form1_Load;
	}
}



public static class CueBannerText
{
	[DllImport("user32.dll", CharSet = CharSet.Auto)]
	private static Int32 SendMessage(IntPtr hWnd, int msg, int wParam, 	[MarshalAs(UnmanagedType.LPWStr)]
string lParam)
	{
	}
	[DllImport("user32", EntryPoint = "FindWindowExA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
	private static extern IntPtr FindWindowEx(IntPtr hWnd1, IntPtr hWnd2, string lpsz1, string lpsz2);

	private const int EM_SETCUEBANNER = 0x1501;

	public static void SetCueText(Control cntrl, string text)
	{
		if (cntrl is ComboBox) {
			IntPtr Edit_hWnd = FindWindowEx(cntrl.Handle, IntPtr.Zero, "Edit", null);
			if (!(Edit_hWnd == IntPtr.Zero)) {
				SendMessage(Edit_hWnd, EM_SETCUEBANNER, 1, text);
			}
		} else if (cntrl is TextBox) {
			SendMessage(cntrl.Handle, EM_SETCUEBANNER, 1, text);
		}
	}
}

The above code is working good in Windows 7 and above. But in windows xp it is not working properly. In windows xp the cue text disappears when we click on text box.

Secondly I want to change the color of cuetext (currently it is in grey).

Is it possible to achieve my requirements using current code? Or Is there any other suitable methods for me?
AnswerRe: Implementing a Cue Banner to a textbox in windows xp with custom color Pin
Richard MacCutchan9-Aug-16 22:11
mveRichard MacCutchan9-Aug-16 22:11 
QuestionHTML Tag Pin
Member 126768148-Aug-16 22:23
Member 126768148-Aug-16 22:23 
GeneralRe: HTML Tag Pin
Richard MacCutchan8-Aug-16 23:18
mveRichard MacCutchan8-Aug-16 23:18 
AnswerRe: HTML Tag Pin
Bernhard Hiller9-Aug-16 21:12
Bernhard Hiller9-Aug-16 21:12 
SuggestionRe: HTML Tag Pin
Richard Deeming10-Aug-16 1:21
mveRichard Deeming10-Aug-16 1:21 
QuestionGet Value of Datasource When Selected Item in ComboBox Pin
Mostafa_Hosseini8-Aug-16 5:40
Mostafa_Hosseini8-Aug-16 5:40 
AnswerRe: Get Value of Datasource When Selected Item in ComboBox Pin
OriginalGriff8-Aug-16 6:05
mveOriginalGriff8-Aug-16 6:05 
GeneralRe: Get Value of Datasource When Selected Item in ComboBox Pin
Mostafa_Hosseini8-Aug-16 6:18
Mostafa_Hosseini8-Aug-16 6:18 
GeneralRe: Get Value of Datasource When Selected Item in ComboBox Pin
OriginalGriff8-Aug-16 6:40
mveOriginalGriff8-Aug-16 6:40 
AnswerRe: Get Value of Datasource When Selected Item in ComboBox Pin
henry harrison11-Aug-16 9:03
henry harrison11-Aug-16 9:03 
Generalhow to calculate percentile from excel column? Pin
Mallesh Shantagiri8-Aug-16 0:26
Mallesh Shantagiri8-Aug-16 0:26 
GeneralRe: how to calculate percentile from excel column? Pin
dan!sh 8-Aug-16 0:32
professional dan!sh 8-Aug-16 0:32 
GeneralRe: how to calculate percentile from excel column? Pin
Nicholas Marty8-Aug-16 0:32
professionalNicholas Marty8-Aug-16 0:32 
GeneralRe: how to calculate percentile from excel column? Pin
Cornelius Henning8-Aug-16 1:01
professionalCornelius Henning8-Aug-16 1:01 
GeneralRe: how to calculate percentile from excel column? Pin
ZurdoDev8-Aug-16 1:53
professionalZurdoDev8-Aug-16 1:53 
GeneralRe: how to calculate percentile from excel column? Pin
Slacker0078-Aug-16 2:05
professionalSlacker0078-Aug-16 2:05 
GeneralRe: how to calculate percentile from excel column? Pin
W Balboos, GHB8-Aug-16 3:18
W Balboos, GHB8-Aug-16 3:18 

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.