|
Yeah, I assume it just does a last character check and does not check the \ if that is the last character
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Thanks
Seems to function exactly how i was wanting it to
Very much appreciated
|
|
|
|
|
Yeah, the "t" in the format is interpreted as a request for "am" or "pm" as appropriate; so in the afternoon, you get "pxp", in the morning you'd get "axa".
In the future you could try "yyyyMMdd_hhmmss.'txt'" .
Oh, and use HH to get 24-hour time.
modified on Thursday, August 27, 2009 3:19 PM
|
|
|
|
|
Ahhhh, thankyou.
All seems much clearer now.
Thanks for the extra tip too
|
|
|
|
|
|
hi guys
i have a grid in whihc i have two columns these are check box columns
now i want to iterate all the rows of grid and to perform some action but only if one of the two check box columns is active or checked else i am skipping the current row
i am doing the floowing but it is not working correctly
(!(Convert.ToBoolean(ugrRow.Cells["Add to device "].Value)) && Convert.ToBoolean(ugrRow.Cells["Discard"].Value)))
continue;
else
{perform logic here .}
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
try this...
if((bool)ugrRow.Cells["Add to device "].Value || (bool)ugrRow.Cells["Disgard"].Value)
{
}
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
How to pass apostrophe to .Trim() Method ?
It is working
sValues.Trim(',')
But here is problem
sValues.Trim(''')
|
|
|
|
|
|
hii...
i enter value in textbox which is number eg:1001
now i want to convert this into string.like:
one thousand and one.
how can i do it using csharp...
reply....
|
|
|
|
|
easy...
int number = 1001;
switch(number)
{
case 0:
return "zero";
case 1:
return "one";
case 1001:
return "one thousand and one";
}
... No, I'm joking. But not far off, have a look at this[^]
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
http://www.blackwasp.co.uk/NumberToWords.aspx
Please refer this site easy for you.
|
|
|
|
|
Very useful, I'll keep it in mind if I ever need to use it
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Ah, so you get paid by the number of lines of code...
|
|
|
|
|
I wish, because then I would be intentionally making the most inefficient programs ever!
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
That's a homework problem that shows up here many times at this time of year; you can search.
|
|
|
|
|
Hey, this is fairly simply question, I believe, just something very new to me.
I recently downloaded an SDK and want to access it with my c# console. I cannot seem to find it in my COM references??
My actual aim is to use the ConvertStringSidToSid function call
http://msdn.microsoft.com/en-us/library/aa376399%28VS.85%29.aspx[^]
Which is apparently is in the SDDL.h header.
I'm trying to add the SDK reference but it doesn't appear in the list of COMS. Any help for going about this would be brilliant.
Thanks you
|
|
|
|
|
|
Wow. can't believe I hadn't come across that site. I now have to issues. I have tried two of the approaches mentioned.
<pre>//SecurityIdentifier is defined in the System.Security.Principal namespace.
SecurityIdentifier si = new SecurityIdentifier(sidBytes, 0);
return si.ToString();</pre>
runs into the error stating "SIDs with revision other than '1' are not supported.Parameter name: binaryForm"
When trying to compile the function which includes
<pre>finally
{
LocalFree(ptrSid);
}
return sidString; </pre>
I cannot find the LocalFree function, what object does it belong in?
Many Thanks
|
|
|
|
|
|
public static string GetSidString(byte[] sid)
{
IntPtr ptrSid;
string sidString;
if (!ConvertSidToStringSid(sid, out ptrSid))
throw new System.ComponentModel.Win32Exception();
try
{
At the !ConvertSidToString, I am getting the error "The security ID structure is invalid"
I'm trying all 3 functions now. I'm getting the error from my previous post, the error above and the 3rd function, the very long one on pinvoke.net gives the same result "S-0-0x2x2x2x2x2x2x" every time.
I only need one to work!! 3 functions and they all have problems.
Thanks for the help so far.
|
|
|
|
|
|
I'm not after getting the SID from the user. I don't have the user details. Although I have is the binary value of an SID and I somehow need to get it into it's correct format.
Thanks
|
|
|
|
|
Here is my test code and it's working :
class Program
{
[DllImport("advapi32", CharSet = CharSet.Auto, SetLastError = true)]
static extern bool ConvertSidToStringSid([MarshalAs(UnmanagedType.LPArray)] byte[] pSID, out IntPtr ptrSid);
[DllImport("kernel32.dll", SetLastError = true)]
static extern IntPtr LocalFree(IntPtr hMem);
static void Main(string[] args)
{
System.Security.Principal.WindowsIdentity id = System.Security.Principal.WindowsIdentity.GetCurrent();
byte[] sidBytes = new byte[id.User.BinaryLength];
id.User.AccountDomainSid.GetBinaryForm(sidBytes, 0);
string sidManaged = id.User.AccountDomainSid.ToString();
Trace.Write(sidManaged);
string sidUnmanaged = GetSidString(sidBytes);
Trace.Write(sidUnmanaged);
}
public static string GetSidString(byte[] sid)
{
IntPtr ptrSid;
string sidString;
if (!ConvertSidToStringSid(sid, out ptrSid))
throw new System.ComponentModel.Win32Exception();
try
{
sidString = Marshal.PtrToStringAuto(ptrSid);
}
finally
{
LocalFree(ptrSid);
}
return sidString;
}
}
|
|
|
|
|
Hi
Maybe this is the second or third time I'm asking this question here and other programming platforms, yet I still don't have a satisfacting solution/answer.
I would like to be able to get screenshots from a DX game without any black/blank screenshot or desktop views(game is on foreground but desktop is saved in screenshot).
Currently I am using this code to take screenshots, which works most of the time. On XP if anti-aliasing is enabled in game I sometimes get black screenshots. On Vista I sometimes get black screenshots. On 7 if aero is not disabled I get black screenshots all the time or desktop views.
int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
Bitmap bmpScreenShot = new Bitmap(screenWidth, screenHeight);
Graphics gfx = Graphics.FromImage((Image)bmpScreenShot);
gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));
bmpScreenShot.Save("test.jpg", ImageFormat.Jpeg);
I need to take screenshots without these problems without using SlimDX (and other external libraries needed to be installed). But an external DLL is OK.
Thank you. I hope I can solve this with your help.
|
|
|
|