|
You're right I did not properly copied the .ini file, cut and paste gone bad.
When you read with eyes of the mind and you do not see
Thanks again for the time you have dedicated to me
|
|
|
|
|
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.
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?
|
|
|
|
|
Windows XP is now well out of support so you are on your own when trying to implement new features on it. This feature is only officially supported in Vista and beyond, as described at EM_SETCUEBANNER message (Windows)[^]. If you wish to change colours and other behaviours then you will need to write your own implementation, or subclass the control.
|
|
|
|
|
How to save HTML tag through C# ASP.Net Form?. when using Rich text box the browser display Error Message.
|
|
|
|
|
Member 12676814 wrote: when using Rich text box the browser display Error Message. Unfortunately we cannot see your screen so have no idea what that message may be, or what you code is doing at the time.
|
|
|
|
|
There are some measures for preventing injection of malicious data - HTML tags and scripts are considered dangerous input. If you get a message like A potentially dangerous value was detected from the client and you are really sure you want to save that text, you may override the validation behavior of ASP.Net in the individual page by
<%@ Page Language="c#" ValidateRequest="false" ...
and in web.config
<httpRuntime requestValidationMode="2.0" />
|
|
|
|
|
If you're using .NET 4.5, it would be better to set the ValidateRequestMode property[^] on the specific control(s) which should be allowed to contain HTML.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi All!
I Have a Table1 Like This :
---------------------------
myID | myItem | IdCountry
2-----Japan------1
4-----US---------2
5-----UK---------1
7-----Canada----2
---------------------------
Now ,I fill combobox1 from with this Code :
string strQuery= @"SELECT myID,myItem FROM Table1 WHERE IdCountry=1";
SqlConnection cnnCbx = new SqlConnection(cnnClass.CnnString);
cnnCbx.Open();
SqlDataAdapter daCbx = new SqlDataAdapter(strCbxQueryItems, cnnCbx);
DataTable dtCbx = new DataTable();
daCbx.Fill(dtCbx);
cbxKindOfItems.ValueMember = "myID";
cbxKindOfItems.DisplayMember = "myItem";
cbxKindOfItems.DataSource = dtCbx.DefaultView;
Ho Can I get myID Value When I select an Item from Combobox ?
|
|
|
|
|
Try:
var myID = cbxKindOfItems.SelectedValue;
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
You can get the value of myID by calling the
SelectedValue property on the
ComboBox control.
e.g:
MessageBox.Show(cbxKindOfItems.SelectedValue.ToString());
To show the ValueMember of the SelectedItem.
Hope it helps..
|
|
|
|
|
Hello All , i'm stucked in C# , to get the percentile from array of column values .please check the below code and let me know how can i pass the arguments to the method .
public double Percentile(double[] sequence, double excelPercentile)
{
Array.Sort(sequence);
int N = sequence.Length;
double n = (N - 1) * excelPercentile + 1;
if (n == 1d) return sequence[0];
else if (n == N) return sequence[N - 1];
else
{
int k = (int)n;
double d = n - k;
return sequence[k - 1] + d * (sequence[k] - sequence[k - 1]);
}
}
and i have the array of data - and also k value as 0.95.
percentile(myarray , K);
the above method sending me error . please let me know , what is my mistake.
modified 8-Aug-16 10:57am.
|
|
|
|
|
Mallesh Shantagiri wrote: what is my mistake
For starters, you posted in wrong forum. Try using C# forum or Q & A section.
"You'd have to be a floating database guru clad in a white toga and ghandi level of sereneness to fix this goddamn clusterfuck.", BruceN[ ^]
|
|
|
|
|
You should head over to the Q&A[^] and ask the question there, as the Lounge is the wrong place for programming questions.
|
|
|
|
|
You're gonna get yelled at for not reading the red text at the top of this page!
Get me coffee and no one gets hurt!
|
|
|
|
|
Cornelius Henning wrote: You're gonna get yelled at I think the 3rd person telling them they did wrong fulfills this prophecy.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
So true. 
|
|
|
|
|
Similar to calculating the percentile of respondents will not answer the question because it doesn't belong here.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Mallesh, I applaud you for posting a sample of your code. Thank you for that. When you repost your question, what would really help everyone is if you provided details of what the error is that you are seeing; it's a lot easier to work out what a problem is, if you can isolate the error.
This space for rent
|
|
|
|
|
Off the top of my head, you are trying to do math with an int and a double data type. Without testing your code, I would say this might be a problem. convert the int to double or the double to int, then do the math.
Also, as many, many others have mentioned, you are "technically" not supposed to ask "programming" questions here in the Lounge.
-- Thanks.
|
|
|
|
|
Accidentally i posted here , Sorry for that.
Thanks
|
|
|
|
|
Mallesh Shantagiri wrote: what is my mistake.
Breathing the same air that we do...
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
A little harsh, I think.
He is asking a legitimate question I believe.
|
|
|
|
|
I guess JSOP's message was posted before this thread was moved from The Lounge.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|