|
|
System.Diagnostics.Process.Start(@"C:\WINDOWS\system32\shutdown.exe", "/f /t 00");<br />
|
|
|
|
|
i want to execute media player in my program .
how i can run a specified application from a dialog based program in C#.
erfan
|
|
|
|
|
|
I found this snippet of code from CodeProject
DataSet dsChanges;<br />
dsChanges = ds.GetChanges(DataRowState.Modified);<br />
if(!dsChanges.HasErrors)<br />
{<br />
da.RowUpdating += new SqlRowUpdatingEventHandler(OnRowUpdating);<br />
da.RowUpdated += new SqlRowUpdatedEventHandler(OnRowUpdated);<br />
int res = da.Update(dsChanges);
da.RowUpdating -= new SqlRowUpdatingEventHandler(OnRowUpdating);<br />
da.RowUpdated -= new SqlRowUpdatedEventHandler(OnRowUpdated);<br />
}
From this article:
http://www.codeproject.com/csharp/practicalguidedatagrids3.asp
My question comes from the bolded part. This OnRowUpdated is never declared in this function.
I found another article doing basically the same thing:
public static bool SubmitChanges(ref DataTable tbl, string ConnectionString, string spUpDateName, string spInsertName, string spDeleteName)<br />
{<br />
try<br />
{<br />
SqlDataAdapter adapter1 = new SqlDataAdapter();<br />
if (spUpDateName != "")<br />
{<br />
adapter1.UpdateCommand = DAHandler.CreateUpdateViaSPCommand(spUpDateName, ConnectionString);<br />
}<br />
if (spInsertName != "")<br />
{<br />
adapter1.InsertCommand = DAHandler.CreateInsertViaSPCommand(spInsertName, ConnectionString);<br />
}<br />
if (spDeleteName != "")<br />
{<br />
adapter1.DeleteCommand = DAHandler.CreateDeleteViaSPCommand(spDeleteName, ConnectionString);<br />
}<br />
adapter1.ContinueUpdateOnError = true;<br />
adapter1.Update(tbl);<br />
adapter1.RowUpdated+=new SqlRowUpdatedEventHandler(adapter1_RowUpdated);<br />
<br />
}<br />
catch<br />
{<br />
throw;<br />
<br />
}<br />
return true;<br />
}
Same problem here. Now for the latter one I have the entire class, not just the code snippet and there is no adapter1_rowUpdated.
How do I fix this? What am I missing?
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">leckey wrote:</div>How do I fix this?</blockquote>
Stop trying to develop software by copy/paste. Really, I am not trying to be harsh but if you think that is the way to go you will never stop having the problems I have seen you go through in the past several weeks.
<blockquote class='FQ'><div class='FQA'>leckey wrote:</div>What am I missing? </blockquote>
You are missing how delegates work in .NET. Those bolded parts are handler methods in the class.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
Hi, i'm experiencing a weird bug with some code in my custom control's collection.
I've used this code before in same project and vs05 didn't complain for hundreds of builds...but when i needed to tinker more with the control in the designer...then something happened :P ... i now get this error everytime i add items to the collection and attempt to save or build the code:
<br />
Code generation for property 'Items' failed. Error was: ''StudioListBoxItemTypeConverter' is unable to convert 'StudioControls.Controls.StudioListBoxItem' to 'System.ComponentModel.Design.Serialization.InstanceDescriptor'.'<br />
I tried to seperate the collection from the control to narrow down the bug... "simplified" code for the collection alone are here:
http://focusedwolf.googlepages.com/GenericEventCollectionBase.cs
http://focusedwolf.googlepages.com/StudioListBoxItem.cs
http://focusedwolf.googlepages.com/StudioListBoxItemCollection.cs
http://focusedwolf.googlepages.com/StudioListBoxItemTypeConverter.cs
http://focusedwolf.googlepages.com/TestControl.cs
If you want to see the error, dump all that code into a form project and drag the TestControl onto a form...add an item through the items property...and try to save or build.
-- modified at 16:06 Thursday 6th July, 2006
|
|
|
|
|
I have experienced that. Are you trying to call a specific constructor?
I found some noise that referenced a problem with the version resource using the '*' character. I removed that and it helped but only by making the problem inconsistent. I finally got tired of losing my collection and removed the use of the specific constructor.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
Hmm this is odd... i'm not getting the bug anymore and i didn't do anything except close vs and open it again... zzz owell guess its just one of those things that never makes sense.
|
|
|
|
|
Or because your collection is now empty?
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
No...collection is serializing added items just fine now... lol
|
|
|
|
|
Looked at your TypeConverter. That is the same thing I had only I was getting a constructor with parameters. I would go along fine for days and then start producing that error. I finally got fed up with it and stopped using it. I hope you don't run into the same problem.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
Wow bug is occuring again :P
I think it might be because their are files dependant on classes in other assemblies... or just a weird vs bug...rebuild and reloading vs.net isn't getting rid of error message.
Hmm did some googling and found lots of forums with people that had this problem. This one had some interesting info: http://www.dotnet247.com/247reference/msgs/53/267795.aspx
I seem to remember having a problem similar to this a while back and it was<br />
to do with the control version and the resources being out of whack.<br />
<br />
Edit your control's AssemblyInfo so that you have an explicit version<br />
number, not one with an asterisk in it. Ensure that you do a full rebuild<br />
and maybe even remove the control from the form it's on, the toolbox and<br />
anywhere else you might have it and then add it again using the new version.<br />
<br />
If this doesn't work then I'm sorry for the wild goose chase. It's all I can<br />
think of for now...<br />
<br />
--<br />
Bob Powell [MVP]<br />
Visual C#, System.Drawing
Well i checked all the AssemblyInfo.cs files but i didnt see any "*" in the version number...all were by default 1.0.0.0 or something like that.
Tried removing control from form, but that didnt work. Couldnt figure how to remove items from toolbox other then resetting toolbox...zzz
Wow i got rid of bug...all i had to do was delete every bin and obj folder in the solution.
Wow i got bug back again... i think the cause is code being seperated in differant assembly projects
Ok all code that this control depends on is in a single assembly being referenced by a windows application project and so far no bug I blame vs 2005 entirely! or maybe theirs something i'm doing or not doing... hmm maybe i can find a book on this stuff for 05
|
|
|
|
|
FocusedWolf wrote: This one had some interesting info: http://www.dotnet247.com/247reference/msgs/53/267795.aspx
Yeah, I think that is the same one I mentioned earlier. I did have the '*' in one of my version resources and when I changed it the problem went from "broken" to "intermitent".
FocusedWolf wrote: Ok all code that this control depends on is in a single assembly being referenced by a windows application project
I can't quite picture that from your statement could you clarify please? I will try to duplicate your solution in my project and see if it works for me.
FocusedWolf wrote: I blame vs 2005 entirely! or maybe theirs something i'm doing or not doing
No, it is definitely a bug.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
Err the bug is back.
to re-explain my setup, my solution has a class library project with the control and its items and type converters and that generic event collection thing i made. In same solution, but in a windowsApplication project i reference the control library and drag it from the toolbox to a form.
So i think the bug here is that vs does something when presented with a control... like it "gets used to it" in some way...like when it generates the resx files or something like that. Then even if it seems to work,...you tinker with a property or part of this control and vs tries to re-"get used to it" and makes mistakes cause theirs items serialized in designer class or something...and then the error message... this is so lame lol
|
|
|
|
|
Hi!
How can i update and xml file, i mean i get it in the memory with the XmlDocument class and then i want to add in the middle after and element name another element,node
is there a diffrence between them?
i always get an exception when using the the replace method.
can someone please write and example how i get the node out append it with children and then put it back to the class and then write it out again?
Thanks
|
|
|
|
|
ytubis wrote: can someone please write and example how
Why does everyone expect others to write the code for them?
XmlElement is derived from XmlNode. To append a child node to a give node you would use the aptly named AppendChild method. To save the XmlDocument you would use the cleverly named Save method.
|
|
|
|
|
What might be the name of the method which one would use to load data into an XmlDocument?
:josh:
My WPF Blog[^]
|
|
|
|
|
i simply create new XmlDocument with its string constructor which gets the file path.
|
|
|
|
|
|
I am sorry but i still get the exception that the XML has this Xmlnode,and when i use the replace method i get the same exception, can some one give and example, a link,even from this site.
Thanks
|
|
|
|
|
|
Tricky Microsoft Devils hiding information in DOCUMENTATION... someone should sue them for that!
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
|
I'm still relatively new to SQL and I was wondering whether there was an easier way to do things.
I need to limit a query based on if a field is like one of three values. I can use "WHERE field in ('list one', 'list two', 'list three')", and I can to "WHERE field like 'list one' or field like 'list two' or field like 'list three'". Is there a way, however, to combine 'in' and 'like' to do something like "WHERE field in like ('list one', 'list two', 'list three') ?
|
|
|
|