|
Are you expecting to use a standard int conversion, such as one returned from a C++ API, or do you want to make your own ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
any thing is fine but it must work in c#
if i give system.datetime.now i must be able to convert to integer and again back to datetime.
Thanks and Regards
Madhu
|
|
|
|
|
Well, you realisitically need to invent some way of representing it then. Do you need the time, or just the date. An int is 16 bit, so 0x00000000, you could use one byte for month, one for day and two for year. Or, you could set a base date, and store the date as days from that date. There's all sorts of options.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
You can not convert DateTime object to Int32 but yes you can convert it to Double using ToOADate() method. To generate DateTime object from Double you can use DateTime.FromOADate() method...
For Example
Double d = DateTime.Now.ToOADate();<br />
...<br />
DateTime.FromOADate(d);
Hope this helps you out...
|
|
|
|
|
i want to be converted to int only
Thanks and Regards
Madhu
|
|
|
|
|
Then you need to decide what representation you want to use. THe old 32bit datetime format from C only supports the range 1970 to ~2038(?). If you need a larger range you'll have to loose some precision at the seconds end of the values.
|
|
|
|
|
Hi,
In my C# code there is some glitch but very complex flow diagram used. So, I want to use a tool which will generate Flow Chart or some visualization...
I checked Visuastin Flow chart generator but that is very expensive to me (299$) comparing the features they are providing. Do you know any better tool for this purpose ?
I also tried, CodeVisual but that tool is just like an immatured toy, not that good enough.
Thanks
|
|
|
|
|
hello sir
I'm trying to format the month name in dropdownlist. I have Month, such as 1,2,3,4,5,6, etc. I want them to display as Jan, Feb, Mar,April etc.ANd i want to show the current month in drop down as sep.help me
thanks
prabhakar dwivedi
|
|
|
|
|
I'm not sure where you're stuck. If you put the names into the list, you can get your number out by adding one to the selected index.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi
You can use DateTime.ToString method to achive this...
This code will help you out
for(int month=1; month<=12; month++)
dd.Items.Add(DateTime.Parse(string.Format("{0}/1/1", month)).ToString("MMM"));
If you need full name of month then use MMMM instead of MMM.
|
|
|
|
|
Hi all,
I am able to fetch the SID of the user from Active Directory in C#, and I am looking for a way of converting this SID to string format. Also it is required to convert string format to SID using C#.
The code sample for converting from a binary SID to a String SID is easily available, and I can find a C++ function to do this. Is there any way to do in c#
Regards
Sar.
|
|
|
|
|
Hello
I have to set default sound card devices in c#.NET ,how can I do this programatically.
Thanks in advance
Yogesh_T
|
|
|
|
|
Hi,
If I have class named "setting_dataTableAdapter" and I want to instantiate this class with a variable settingsAdapter and declare the variable as static, will it be a problem in runtime ? I needed to do that because, this settingsAdapter variable should be a global variable so that all methods can access and at the same time I have static methods who can take only static variables so I had to adopt the following code.
static setting_dataTableAdapter settingsAdapter = new setting_dataTableAdapter();
Please let me know your opinion.
Thanks.
|
|
|
|
|
i think you are missing public keyword...
try the below.
public static setting_dataTableAdapter settingsAdapter = new setting_dataTableAdapter();
Where there is a will,there is a way.
|
|
|
|
|
Say I copy a line of text from a website in Internet Explorer, and then I paste it to a textbox in my C# program, now when I do this the program automatically pastes the http address of the site onto another textbox in the program. How would I do this? Specifically, how would I get a copy of the address string (from IE or from Firefox if possible)? What is the class to use?
|
|
|
|
|
hi
i use vs2005 and i have form that has some controls like textbox and label and ... . i want to print my form with controls . how to do ??
thanks
|
|
|
|
|
|
|
I want to use read system BIOS serial number from my C# application , any Ideas . I got an answer suggesting the use of Win32_bios wmi class , any one used it before , where can i find this class , any particular DLL ?
unitecSoft
We will Either Find A Way , OR Make One .
|
|
|
|
|
unitecsoft wrote: I want to use read system BIOS serial number from my C# application
I have actually done that with QBASIC running on Windows NT 4.0. I used the Peek statement. As for C# and pointers you cannot read farther than where your application's allocated memory ends. I dont know of any API that would allow you to read anything from the BIOS, but you could write a driver and then use C# to interface with it's API
=====Brain melting code=====
static int Sqrt(int x){ if (x<0) throw new ArgumentOutOfRangeException(); int temp, y=0, b=0x8000, bshft=15, v=x; do { if (v>=(temp=(y<<1)+b<<bshft--)) { y+=b; v-=temp; } } while ((b>>=1)>0); return y; :omg:
====TSI TLFL EEOOLHTG=====
^^^^^^^^^^^^^^^^^
Decode that and you will win.;P
============Hint===========
cout << "33 20 57 4F 52 44 53 62 63 6B 77 6F 72 64 73";
|
|
|
|
|
System.Management.ManagementClass("Win32_BIOS");
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
See here[^] maybe it is some helpful to you
|
|
|
|
|
How do I convert the following unmanaged C++ structures in C# (which I will be using in PInvoke calls)?
typedef struct
{
unsigned char Camera;
unsigned char DecoderId;
} VIDEO_SEQ_CMD;
typedef struct
{
int CompressionMode;
VIDEO_SEQ_CMD VideoSequence[64];
} USER_CONFIG_DATA;
I think the following works for the first struct. I'm not sure how to handle the array in the second struct.
[StructLayout(LayoutKind.Explicit, CharSet = CharSet.Ansi)]
public struct VideoSeqCmd
{
[FieldOffset(0), MarshalAs(UnmanagedType.U1)]
public byte Camera;
[FieldOffset(1), MarshalAs(UnmanagedType.U1)]
public byte DecoderId;
}
Thanks!
|
|
|
|
|
See this...
<br />
[StructLayout(LayoutKind.Explicit, CharSet = CharSet.Ansi)]<br />
public struct UsserConfigData<br />
{<br />
[FieldOffset(0), MarshalAs(UnmanagedType.I4)]<br />
public int CompressionMode;<br />
[FieldOffset(1), MarshalAs(UnmanagedType.ByValArray, SizeConst=16, ArraySubType=UnmanagedType.Struct)]<br />
VideoSeqCmd [] VideoSequence;<br />
}<br />
|
|
|
|
|
hi
can you provide me some link for any good artcle using code snippets
or some tips for them
thanks
|
|
|
|