|
|
How can I set characters limit in the ProperGrid control property. Like, a Name property is being diplayed inside the propertygrid. I don't want user to enter more than 5 characters in the Name field.
I know if i have to check the string lenght but how can i stop the user not exceed more than that
|
|
|
|
|
netJP12L wrote: I don't want user to enter more than 5 characters in the Name field.
Why limit people to such few characters?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
i am trying to develop a player using mci...
i want to control volume with the track bar..... so what i did is
//
code//
mcisendstring(String.Format("set {0} volume to {1}",file, trackbar.value),String.Empty,0,0);
i don't see any effect
can someone help with this./..
another problem is getiing the length....
i don't know the format i am gettin my values in
what i do is
// first
mcisendstring("set file time format ms",String.Empty,0,0);
mcisendstring("status file length",result,255,0);
the result contains values which is unclear to me....
cud someone help with this as well?
thankx so much
//
|
|
|
|
|
Not sure. Do you care to tell us a little more about mcisendstring ?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Paul Conrad wrote: mcisendstring?
mciendstring is a system call part of the MCI API(MULTIMEDIA CONTROL INTERFACE.... it takes a list of command strings to make these calls....
i get some help on it from the MSDN.. maybe more can be read there..
examples" mcisendstring("set CDAudio door open", Sring.Empty,0,0)"===
this will open a CD tray....
|
|
|
|
|
My string is serial of words( abc& # SomeInterger; )
How can I convert it to utf8 as ( abc? )
Thanks!
QuynhTD
modified on Tuesday, December 18, 2007 1:44:31 PM
|
|
|
|
|
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hello everybody,
does anybody have any idea of how it's possible to access a specific TreeNode object in a TreeView, given the 'FullPath' property of that node ?
Thanks for helping,
Pat.
p.f. Goudjo-Ako
Bringing our energy together !
|
|
|
|
|
|
Hi,
I have bought a Digital Pen that its handwriting only works with Info Path.
Is there any software that make my Pen (Genius G-Pen 560) compatible with any windows Form?
Best wishes
|
|
|
|
|
In an application I set the windows cursor to a WaitCursor, but other components within the same application set it back to Default. Is there a way to set the cursor type, and prevent other areas of the same application from changing it? Thank you in advance.
Kalvin
|
|
|
|
|
You can set the UseWaitCursor property to force the WaitCursor to be the one used when the mouse is within the bounds of an object with that property set to "true". I don't think that there is any way to prevent another app from changing it unless you are coding the app. If you are coding it, then look into thread synchronization techniques. The method I would try to implement would be to acquire a named mutex (or static variable) anytime you want to change the cursor. Then, if you want to prevent others within your app from changing it, just hold the mutex (static variable). Hope this helps,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Thanks a lot for your reply.
The cursor is being changed from different components that together make an application. Some components I have access to change, and others I can't access or modify the code. I also should have stated that this is in VS 2003 and the WaitCursor isn't available. I can't access other components to make them use a mutex. If those are the only options in C#, is there a way to use an API to do this or is doing this just not the way windows works?
Thanks again.
|
|
|
|
|
I'm not really certain if the following would lock only a local copy of the cursor, or if it would lock the cursor resource for all applications, but you could try to use the WinAPI calls LoadCursor[^] followed by a LockResource[^]. Again, I don't have time to experiment with these, but they would be worth looking into. Another idea would be to implement a timer that continuously checks the cursor, and sets it back if it is changed (this method scores a 9/10 on the hack scale). A better idea would be to listen to the windows events (like Spy++ does) and block any attempt at sending a WM_SETCURSOR (I assume this is the message being sent) message. I've never tried to intercept windows messages, but I'm sure you can google to discover how to go about this (perhaps look at overriding DefaultWndProc and WndProc methods on Control objects?). Please post results if you get it working.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Thank you for the reply and all of your help.
|
|
|
|
|
I need to programatically convert float values like 17.1054688 to 17.11 in C#
i.e want to restrict the float values upto 2 decimals.
For this I have written following code:
<br />
private void Roundupto2Decimals(ref float fVal)<br />
{ <br />
string strVal = fVal.ToString("F2");<br />
fVal = float.Parse(strVal);<br />
double dVal = (double)fVal;<br />
}<br />
In VS2005 watch window, I get the correct value for fVal.
for e.g:
Input : 17.1054688
strVal: "17.11"
fVal : 17.11
but ---> (double)fVal : 17.110000610351563
I am not sure when I typecast the same float to double I get unepcted value.
I expect dVal to be 17.11 too.
Can any one help me understand what is happening?
Thanks and Regards,
Arti Gujare
|
|
|
|
|
Hi,
I think it's because C# float is not exact. Try to use decimal instead.
zilo
|
|
|
|
|
It's all due to the way floating point numbers are represented - some numbers can't be represented exactly, so will have very tiny errors.
As suggested by the other poster, if you are using small numbers, and require high precision, then the Decimal type would be more suitable.
|
|
|
|
|
I tried with decimal too.
Did not help much..
This is what I tried.
<br />
private void Roundupto2Decimals(ref float fVal)<br />
{<br />
decimal decVal = Math.Round((decimal)fVal, 2);<br />
fVal = (float)decVal;<br />
double dVal = (double)fVal;<br />
}<br />
Any other idea?
|
|
|
|
|
You are still using float, aren't you ?
what about this:
double dVal = Math.Round((double)fVal, 2);
if you need that value exactly, just use decimal in any calculation you are planing. If you want to display exactly 10.11, use decimal. If you're just wondering why is it different, we explained you why and don't worry about it anymore
zilo
|
|
|
|
|
The problem is that the third party dll uses float value in its class.
So I really cant get rid of the float and I still need to use this dll.
As a work around I am using Math.Abs() method to find out tolerable difference between the two float values instead of checking exact difference using "==" with floats.
|
|
|
|
|
|
Thanks you Led.
The link is quite useful.
|
|
|
|
|
hello, math.round donot support float, its argument must be Double.
for example :
Double dblValue = 123.126789;
dblValue = Math.Round(dblValue, 2);
MessageBox.Show(dblValue.ToString());// Displays 123.13
I think u can continue your work.
Best of Luck.
Dipak
|
|
|
|