|
Hello,
The kernel32.dll provides a method called SetLocalTime:
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public struct SystemTime
{
public short sYear;
public short sMonth;
public short sDayOfWeek;
public short sDay;
public short sHour;
public short sMinute;
public short sSecond;
public short sMilliSeconds;
}
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
public static extern bool SetLocalTime(ref SystemTime time);
Or call the System Timesetting directly over a process:
using System.Diagnostics;
ProcessStartInfo TimeSetting = new ProcessStartInfo(@"C:\WINDOWS\system32\rundll32.exe","shell32.dll,Control_RunDLL timedate.cpl,,0");
TimeSetting.UseShellExecute = false;
TimeSetting.WorkingDirectory = @"C:\WINDOWS\system32";
Process TSet = Process.Start(TimeSetting);
TSet.Dispose();
TSet = null;
Hope it helps!
All the best,
Martin
|
|
|
|
|
In the OS? Or just for your application?
I wouldn't attempt the former.
|
|
|
|
|
can sum1 plz provide me codes to make a media player in c#!!!
vid thanx...
Tarun SUneja
|
|
|
|
|
Nope. We're here to help you write your own code, not just hand over our own work to someone to play with.
|
|
|
|
|
Hi,
I'm wondering if there is a content alignment feature inside container controls (Panel, TableLayoutPanel) . e.g. I have several controls in a TableLayoutPanel. Those controls may change their size on runtime. I want to place them into a grid (like html table) one per cell and align them to middle of the cell(horizontally and vertically). Is this possible without writing custom code ? Until now, I figured out only way that to keep them aligned is to dock-Fill them.
|
|
|
|
|
Hello,
Have a look at the "Anchor" property of the controls?
Maybe it fits your needs.
All the best,
Martin
|
|
|
|
|
Thanx for answer.
anchor doesn't provide what I need.
|
|
|
|
|
do anyone have the coding for messenger in C# language or any other language
kindly reply asap
|
|
|
|
|
It's easy to build a chat application. But a messenger like msn is far more complicated. The client should be in sync with the server. i.e: whenever you get a new message the client should be intimated. Mechanisms like polling in regular interval would be complicated,or rather may not be optimal . I think msn messenger has implemented a tcp channel for that purpose.
|
|
|
|
|
there is a file called class diagam in the project Now my qustion is what's the utility of this file.Just to view the class (the project have)?
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
The benifit of the class view:
Shows all the classes include in the project.
provides the definition for all the classes used.
Faster reference if you want to go to any part of the class just double click the class name
Overall it is for better understanding of your project!
gauthee
|
|
|
|
|
Hey guys, I'v worked on Windows application for quite a while and it switched to ASP.net about 3 months ago ! Of course it's something totally different and I was wondering if you could hook me up with some practical sources ! as well some websites to get some ready projects to get a better idea !
Thanx
Mr.K
|
|
|
|
|
|
|
Its 2.0 ! the thing is ve got tons of ebooks about this, I need something that gets to the point like i dunno builds a complete website from scratch ! something like that !
Mr.K
|
|
|
|
|
You can't start to build the complete website straight away. You have to read the book and try some samples steps by steps.. then, if you get some ideas how web application works, you can start the project... You can also participate in opensoure ASP.NET project if you wanna practice ...
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Can anybody tell me how to convert a .msg file to .eml file.using a .net component or some C# .net or even a COM libary.
Thanks in advance.
|
|
|
|
|
Xs_2 wrote: Can anybody tell me how to convert a .msg file to .eml file.using a .net component or some C# .net or even a COM libary.
I'm not sure about .NET components. But there are some free converting tool available for that...
You may wanna read this thread.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=6706&SiteID=1
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
HI I have created an application that uses the registry.
On the application there are two textboxes and a button. When the form is loaded the first textbox displays a font that has been declared in the registry and the second text box displays the font size, again declared in the registry. The button allows the user to change the font and font size using a FontDialog. When this dialog is opened (by clicking the button), the selected font is the font declared in the registry. I also want the font size that is declared in the registry to be selected in the dialog. The font name works perfectly fine, I am just having trouble with converting the font size.
First of here is my code:
string font;
int size;
FontDialog selectFont = new FontDialog();
font = Convert.ToString(Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\RegKey_test", "Font", ""));
selectFont.Font = (Font)TypeDescriptor.GetConverter(typeof(Font)).ConvertFromString(font);
size = Convert.ToInt32(Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\RegKey_test", "FontSize", ""));
selectFont.Font.Size = (Size)TypeDescriptor.GetConverter(typeof(Size)).ConvertFrom(size);
if (selectFont.ShowDialog() == DialogResult.OK)
{
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\RegKey_test", "Font", selectFont.Font.Name.ToString());
TBFont.Text = selectFont.Font.Name.ToString();
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\RegKey_test", "FontSize", selectFont.Font.Size, RegistryValueKind.DWord);
TBFontSize.Text = selectFont.Font.Size.ToString();
}
I am unsure if I should set the variable size as an integer or a string, and then according to this how is it converted to Font.Size?
Lucy
|
|
|
|
|
Lucy_H85 wrote: selectFont.Font.Size = (Size)TypeDescriptor.GetConverter(typeof(Size)).ConvertFrom(size);
I think Size property is readonly. so, try like that..
Example 1
Label1.Font = New Font("Tahoma", 30)
Example 2
<br />
font = Convert.ToString(Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\RegKey_test", "Font", ""));<br />
<br />
size = Convert.ToInt32(Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\RegKey_test", "FontSize", ""));<br />
<br />
selectFont.Font = new Font(font,size);
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
That works great! Thanks! Didnt realise it would be so easy!
|
|
|
|
|
Hi
i am using ms Glee and visual studio Graph class and i have created an ellipse and displayed on Glee gview tool so i want serialize this ellipse in an xml file
here is what i have done in creating an ellipse.
Graph g = new Graph("graph");
g.AddNode("Ellipse");
gViewer1.Graph = g;
here is where i am trying to serialise but it
XmlSerializer mySerializer = new XmlSerializer(typeof(Graph));
XmlTextWriter myWriter = new XmlTextWriter(@"C:\users\dake10\documents\jacob\motors.xml", Encoding.UTF8);
Graph g = new Graph("");
g.AddNode("House");
mySerializer.Serialize(myWriter,g);
I get this error message"Microsoft.Glee.Drawing.Graph cannot be serialized because it does not have a parameterless constructor."
Mamphekgo
|
|
|
|
|
You can't serialize a Glee graph object using an xmlserializer.As the exception says it doesn't have a parameterless constructor.
If your aim is to draw graph,I think still graphviz is the better choice to GLEE
|
|
|
|
|
hi all
i Wount to sort the DataGridView by the column 1 it's have datatype Date
How i can that
thanks for any help me
Thaer
|
|
|
|
|
Hello, this is Sergey
I have a problem with dataGridView:
One of the predefined columnes has type DataGridViewComboBoxColumn with predefined items.
When i'm adding new row
int index = datagrid.Rows.Add();
and after that trying to set default value in DataGridViewComboBox,
DataGridViewCell dgvc = datagrid.Columns[2].CellTemplate;
dgvc.Value = "High";// it has index = 0 in items of column
datagrid.Rows[index].Cells[2] = dgvc;
it throws messages that its incorrect. I've tried in other ways, searching for information, nut i didn't find it
Could you help me to set this shirt default value to combobox and get then it back?
Thanks,
Sergey
|
|
|
|