|
I have been search for a way to do this, and I haven't been able to find anything for .NET 2.0 There are a few solutions for 1.0, but not for 2.0 =( Can anyone point me in the right direction here? Thanks =)
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
I thought of another way to do it. I can use process.start to start shutdown.exe, and pass the argument to restart the system That will work just fine.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
(Code for what he is talking about)
this worked for me:
Process p = new Process();<br />
p.StartInfo.FileName = "shuwdown";<br />
p.StartInfo.Arguments = "-r -t 0";<br />
p.Start();
the best way is to add a static boolean and if you need to reboot set it to true then add the following as the last thing in your main() function:
if(bDoReboot)<br />
{<br />
Process p = new Process();<br />
p.StartInfo.FileName = "shuwdown";<br />
p.StartInfo.Arguments = "-r -t 0";<br />
p.Start();<br />
}
this has issues tho because they might be a limited user and not allowed to shutdown
|
|
|
|
|
Theres no reason code written to target the 1.x framework would fail to work in the 2.x framework!
|
|
|
|
|
|
Even that's not acceptable. What if the user isn't at the machine when the 30s countdown starts, or what if they're doing something in a different app that can't be saved immediately? Anything other than a "This application needs to reboot your system. Reboot now? Yes/No" dialog that honors the no choice is totally unacceptable. I've encountered a few that didn't in the past. For some odd reason I don't think any of them lasted more than 10 minutes on my harddrive.
--
You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
|
|
|
|
|
Whoops, yeah. Present the MessageBox, and if Yes, then proceed to InitiateSystemShutdown.
|
|
|
|
|
|
Hi!
I have a listbox control. I want to change the color of each item based on some condition. But i don't know how change the color of an item of listbox control. Please, help me in this regard. Thanks!
|
|
|
|
|
There's no built-in way to do this. There is, however, a way to do this with the ListView control. ListViewItem.BackColor
|
|
|
|
|
Thanks!
I have coded it in the following way:
private void lstBoxSystemTypes_DrawItem(object sender, DrawItemEventArgs e)
{
ListBox listBox = (ListBox)sender;
string itemValue = listBox.Items[e.Index].ToString() ;
e.DrawBackground();
Brush brush = Brushes.Red;
e.Graphics.DrawString(itemValue, e.Font, brush, e.Bounds, StringFormat.GenericDefault);
e.DrawFocusRectangle();
}
But the itemValue (string variable at line 4) contains something like "System.Data.Data". I want the actual value to be painted.
Thanks once again
|
|
|
|
|
Hello! I made it possible in the following way:
private void lstBoxSystemTypes_DrawItem(object sender, DrawItemEventArgs e)
{
ListBox listBox = (ListBox)sender;
string itemValue = listBox.Items[e.Index].ToString() ;
System.Data.DataRowView dataRowView = (System.Data.DataRowView)listBox.Items[e.Index];
e.DrawBackground();
Brush brush = Brushes.Red;
if (bool.Parse(dataRowView["Approved"].ToString()))
brush = Brushes.Black;
e.Graphics.DrawString(dataRowView["Name"].ToString(), e.Font, brush, e.Bounds, StringFormat.GenericDefault);
e.DrawFocusRectangle();
}
But there is another problem: item's color doesn't change when it is selected.
|
|
|
|
|
How to Import Data from MS Excel to DataSet using C#. View them into DataGridView, populate into SQL Server 2000 and BindingData in controls
Learning forever
|
|
|
|
|
tuansara wrote: How to
Indeed! If only the internet had sites where people published documentation and instructional articles and blogs related to issues such as this. And then if only there existed some way to search the internet using key words to locate that type of information.
If only....
|
|
|
|
|
How to Import Data from MS Excel to SQL Server 2000????
Learning forever
|
|
|
|
|
You question is very general, so this will be a general answer: first, get the data out using something like Visual Studio Tools for Office (google it). Then use ADO.NET to insert that data into SQL.
|
|
|
|
|
I have an InfoPath file and want to create an xml file of it using C#.
The xml file should look exactly like the one that would be saved if I opened the form with InfoPath and saved it as xml.
Can that be done somehow with C#?
I've tried to rename the xsn file to cab, extract template.xml and sampledata.xml, but they are nothing like the xml file that is created from InfoPath.
|
|
|
|
|
Start here:
http://msdn2.microsoft.com/en-us/library/bb448854.aspx
Then the following will be useful too.
http://www.microsoft.com/downloads/info.aspx?na=47&p=1&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=ad0b72fb-4a1d-4c52-bdb5-7dd7e816d046&u=details.aspx%3ffamilyid%3d8D46C01F-E3F6-4069-869D-90B8B096B556%26displaylang%3den
http://www.microsoft.com/downloads/details.aspx?familyid=ad0b72fb-4a1d-4c52-bdb5-7dd7e816d046&displaylang=en
|
|
|
|
|
Thanks, it looks interesting.
Are you sure that it works for InfoPath files?
It's a part of MS Office, but it is not listed.
Have you or anyone else done this before?
Would be nice to see some examples on how to make the xml file.
|
|
|
|
|
|
I'll take a look at it.
But I'm not to hopefull that it works with InfoPath forms because according to Microsoft it only works with:
* This download works with the following Office applications:
o Microsoft Office Excel 2007
o Microsoft Office PowerPoint 2007
o Microsoft Office Word 2007
|
|
|
|
|
Hello!
I have a question regarding listviews when using checkboxes. I have created a listview with checkboxes but I have noticed an irritating thing about these: when trying to check the checkbox, it glitches. On some mouse clicks it becomes checked/unchecked and on some nothing happens. This is on ordinary clicking. If I instead click and hold the button for a little longer while it always becomes checked/unchecked.
I have tried this on several computers and with different mouses so that is not the problem.
Has anyone else noticed/gotten this problem?
|
|
|
|
|
No...I haven't run across that error. ...One thing though, have you tried subscribing to all of the available events supported by the ListView? Try that and pop up a MessageBox in each handler that tells you where you are. Your "Checkbox click" is probably getting hijacked by some separate event that supersedes it.
"I need build Skynet. Plz send code"
|
|
|
|
|
Hi All,
How do I Print a web page opened with IE from external application ?
and also if any body knows a good technical documentation about IE, like Object Hierarchy. Please let me know.
Thanks,
Dinesh
_______
|
|
|
|
|
I am tring to replace "\" to "\\".
e.g.
--------------------------------------------------------
string strFName = "";
strFName = Application.StartupPath.ToString();
// Value get by above code is C:\UPLOAD\UPLOAD
strFName = strFName.Replace("\","\\");
--------------------------------------------------------
But this code is not getting compile.
KK
|
|
|
|