|
Hi,
you could use a FileWatcher and teach your app to exit gracefully when something
happens to a specific file (rather than an installer trying to kill your process !)
|
|
|
|
|
That worked! Thanks for your help...I put a FileWatcher in my application and told it to watch deletion of the .exe. On deletion, then call Application.Exit() and that worked great!
Many thanks,
Adam
|
|
|
|
|
I have assigned a variable of type object to a method.
i.e. object o = getDataFromWebService(int intData);
Then hovering over o or looking at the values in Locals Window for o, I can see the data has been returned. Something like:
o[0]
o[1]
o[2]
etc...
Theh for each index, in the locals window I can see the fields returned also.
In code, how can I refer to these values please?
I tried something like:
string x = o[0].ToString();
but I get this errorL:
Cannot apply indexing with [] to an expression of type 'object'
Thanks
|
|
|
|
|
arkiboys wrote: a variable of type object
Everything is of type object in .NET
arkiboys wrote: In code, how can I refer to these values please?
Cast the object to the appropriate class. I can't tell you what that is because you have not supplied sufficient information.
|
|
|
|
|
I actually want to open Notepad on a remote machine.
By writing the following code, I am able to run it, but the problem is that it is runs in background. I can only see it by opening up the windows task manager of the remote machine.
ConnectionOptions objConnectionOptions = new ConnectionOptions();<br />
objConnectionOptions.Impersonation = ImpersonationLevel.Impersonate;<br />
objConnectionOptions.EnablePrivileges = true;<br />
objConnectionOptions.Username = strUserName;<br />
objConnectionOptions.Password = strPassword;<br />
ManagementScope objManagementScope = new ManagementScope(@"\\remote-computer-name\ROOT\CIMV2", objConnectionOptions);<br />
objManagementScope.Connect();<br />
<br />
ManagementClass processClassFinal = new ManagementClass(objManagementScope, new ManagementPath("Win32_Process"), null);<br />
ManagementBaseObject inParamsFinal = processClassFinal.GetMethodParameters("Create");<br />
inParamsFinal["CommandLine"] = @"c:\windows\notepad.exe";<br />
ManagementBaseObject outParamsFinal = processClassFinal.InvokeMethod("Create", inParamsFinal, null);
Is there anyone who could help me in sorting out this problem
Thanks.
Sarfraz
|
|
|
|
|
I already told you[^] WMI cannot be used to launch an interactive process on a remote machine and what you had to use to accomplish it.
How many times are you going to ask this question in one day??
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
How to pop-up a JPEG file on clicking a Button:
When i click on the Menu items / Button how to load a JPEG file ???
Thanks & regards,
Jayaraman B
Jayaraman B
|
|
|
|
|
Hi.
Where and where from exactly do you want to load a file?
For example, loading to Bitmap you can do like this:
Bitmap bmp = Bitmap.FromFile("C:\\image.jpg");
And you can use it for example to set your Form BackgroundImage property:
this.BackgroundImage = bmp;
|
|
|
|
|
Hi,all
i wanna to making rectangle move above a line as rectangle considered a packet of data
i write some code but it miss the line so if any one know a method for the shape to follow the the line,
i'll be very pleased
thanx in advance
Generator
-- modified at 9:35 Thursday 1st March, 2007
|
|
|
|
|
hi this will be my input string,
"javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(\"OKButton$_Button\", \"\", true, \"\", \"\", false, true))"
can anyone please give me a matching regex for this string.
the values in the bracket changes but the format remains the same...
i tried with this Regex but its not working
string postBackPattern = @"WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions\('(?<target>.*?)', '(?<argument>.*?)', (?<validation>.*?)(?<everythingelse>.*?)\)\)";
please do help me... its urgent
thanks in advance...
|
|
|
|
|
This looks a bit wierd with all those escaped backslashes and quotation marks, but it works fine for me:
javascript:WebForm_DoPostBackWithOptions\(new WebForm_PostBackOptions\(\\\"([^\"]*)\\\", \\\"([^\"])*\\\", (true|false), \\\"([^\"]*)\\\", \\\"([^\"]*)\\\", (true|false), (true|false)\)
or a little different version:
javascript:WebForm_DoPostBackWithOptions\(new WebForm_PostBackOptions\(\\\"(.*)(\\\")??, \\\"(.*)??\\\", (true|false), \\\"(.*)??\\\", \\\"(.*)??\\\", (true|false), (true|false)\)
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I´m trying to validate a xml file against schema... I had to migrate my code from .net 1.1(where I was using XMLValidatingReader and it was working just fine...) to .net 2.0. The XMLValidatingReader became obsolete, so I tried the XMLReader instead, but I always get only the first error... Here is my sample code:
private void validate()
{
XmlSchemaSet xsc = new XmlSchemaSet();
xsc = this.getSchemaToValidate();
XmlReaderSettings xs = new XmlReaderSettings();
xs.ValidationType = ValidationType.Schema;
xs.ValidationFlags = XmlSchemaValidationFlags.ReportValidationWarnings;
xs.ValidationEventHandler += new ValidationEventHandler(ValidationCallback);
xs.Schemas.Add(xsc);
fs = new FileStream("XMLTest.xml", FileMode.Open, FileAccess.Read, FileShare.Read);
XmlReader vr = XmlReader.Create(fs, xs);
while(vr.Read()) {}
}
private void ValidationCallback(object sender, ValidationEventArgs e)
{
tbErrorMessage += e.Message + Environment.NewLine;
this.numberOfValidationErrors++;
}
Can anyone help me with this?
cellardoor
|
|
|
|
|
Have you considered XmlDocument. In 2.0:
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(xmlFile);
xmlDocument.Schemas.Add(xmlSchema);
xmlDocument.Validate(validationHandler);
Seems simpler.
|
|
|
|
|
I can´t use XmlDocument because my xml files are too big(about 80MB) and I don´t want to load the whole xml into memory... I have to read them sequencially, that´s why I use XmlReader.
cellardoor
|
|
|
|
|
I can't tell you - tried a quick test with code identical to yours except that I used Schema rather than schema set and got multiple errors.
Good Luck!
|
|
|
|
|
It looks very similar like examples from MSDN. I am surprised it doesn't work....
I don't really have much experience with "new" xml classes in .NET 2.0 , but did you consider XmlSchemaValidator[^]?
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
Hi friends.
I am cearting my website ... I need "search" in a webform.
for example, when the user types " demo " in the textbox of the search page, then it should appear all the things in all pages of the website,which is correlate with the word "demo".
Just like the search in codeproject.
how can I do it ?
I just know about searching with a specific field,like user name,age,... but I dont have any idea about a word searching ...
is there any articles which can help me?
Or can anyone help me to write ...?
thanks alot.
|
|
|
|
|
Are you searching i a SQL Database?
--
David Trasbo.
|
|
|
|
|
Put "Like" keyword in your select query and pass different parameters i.e syntax may not be write: Select * from Like="AAA",Like"BBB";
|
|
|
|
|
netJP12L wrote: Put "Like" keyword in your select query and pass different parameters i.e syntax may not be write: Select * from Like="AAA",Like"BBB";
sorry I didnt understand ...
What does "like" do ??
What is "AAA" or "BBB" ...?
I want this search form to work with any word...like codeporject's search ...
plz help me
|
|
|
|
|
Yes,Sorry I forgot to say..
My Database is SQLServer 2000
plz help
|
|
|
|
|
You need to set a criteria for how a particular thing will be searched out in your database.
Like is a keyword that tells the query look for something that i am passing in the parameter. Like keyword is different than Equal or ==. As Obvisouly, equal mean look exactly what I need to search.
SELECT *
FROM QUESTION_PARENT
WHERE (PTYPE LIKE 'searchCriteria')
|
|
|
|
|
Is it possible to set xsd-schema during serialization?
The problem is:
1. I have xsd-schema, for example
<<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementformdefault="qualified" attributeformdefault="unqualified">
<<xs:element name="Mass">
<<xs:complextype>
<<xs:sequence>
<<xs:element name="Gross">
<<xs:simpletype>
<<xs:restriction base="xs:decimal">
<<xs:totaldigits value="12">
<<xs:fractiondigits value="3">
<
<
<
<<xs:element name="Net">
<<xs:simpletype>
<<xs:restriction base="xs:decimal">
<<xs:totaldigits value="7">
<<xs:fractiondigits value="4">
<
<
<
<
<
<
<
In this schama two elements are of decimal type, and they have a template for fractional part.
2. Generate class by schema:
public partial class Mass {<br />
<br />
private decimal grossField;<br />
private decimal netField;<br />
<br />
public decimal Gross <br />
{<br />
get {return this.grossField;}<br />
set {this.grossField = value;}<br />
}<br />
<br />
public decimal Net <br />
{<br />
get {return this.netField;}<br />
set {this.netField = value;}<br />
}<br />
}
3. Do the serialization:
public void Test()<br />
{<br />
Mass mass = new Mass();<br />
mass.Gross = 100.1M;<br />
mass.Net = 7.7M;<br />
<br />
XmlSerializer serializer = new XmlSerializer(typeof(Mass));<br />
TextWriter writer = new StreamWriter("res.xml");<br />
serializer.Serialize(writer, mass);<br />
writer.Close();<br />
}
4. Get the result:
<<mass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<<gross>100.1
<<net>7.7
<
The problem is:
I need the elements of decimal type would correspond the template.
That is I need the result as:
<<mass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<<gross>100.100
<<net>7.7000
<
That is I need the elements have the fractional part as indicated in the xsd-schema.
May be it is possible to solve the problem by using special attributes for elements?
Thanks in Advance
Victor
|
|
|
|
|
I pretty sure you need to implement the IXmlSerializable interface to achieve what you want.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
>>I pretty sure you need to implement the IXmlSerializable interface to achieve what you want.
It seems to be that I want!
Thanks a lot!
|
|
|
|