|
|
i miss spoke
i think there is more to worry about before i take blackjack2150 post seriously
|
|
|
|
|
My appliction uses Microsoft's Indexing Service, i need to ensure that when my software installs it ensures that either the service is already installed or it installs the indexing service.
Thank you!
"Mess with the Best, Die like the rest"
|
|
|
|
|
Hello,
I have a simple question. Suppose you have a class X. Now you have a Class Y, which derives from Class X. Now in Class Y can I create a member which is a object of type X, let the object name be ob.
Now Suppose Class X has a public member int a, would this be a valid statement?
[Object of type Y].ob.a = 10
Thanks
|
|
|
|
|
Ummmm, yeah? But it sounds like a poor design.
|
|
|
|
|
|
I am using a datagrid in ASP.NET. I have column setup with LinkButtons to change that row into a edit row. How do I find what row the LinkButton is in to set the edit row property?
Thanks in advance.
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
If you have used a command field in the gv you should have no problem.
First the gv needs to have the DataKeyNames property set to the Field that has the ID for that table.
Then you should have a method that looks like
protected void gvTrouble_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int QuestionChoiceID = (int)gvTrouble.DataKeys[e.RowIndex].Value;
DeleteRecordByID(QuestionChoiceID);
}
the e.RowIndex tells you what row your in , and that in turn can give you the id
gvTrouble.DataKeys[e.RowIndex].Value
cast or convert that into an int and use it as the id field for a deleteion
private void DeleteRecordByID(int QuestionChoiceID)
{
string quizDelete;
quizDelete = @" Delete Questions where QuestionID = " + QuestionChoiceID + " ";
// be sure to rebind the data after you drop a row.
}
PunchcardRay
|
|
|
|
|
I have an instance of the class mentionned in the subject. When I set a property using the SetPropertyValue and re-read the object from WMI, it has its old value.
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
Which WMI class are you using? What does the code you're using look like?
|
|
|
|
|
I get a ManagementBaseObject instance using ManagementObjectSearcher instance. I can see that the correct instance is returned, but the SetPropertyValue call is ineffective. Anything else I need to do after that?
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
Le Centriste wrote: Anything else I need to do after that?
Nope.
Once again, which WMI class are you retrieving and what does the code look like?
|
|
|
|
|
Sorry, I didn't catch the "WMI classes" thing, I thought ".NET classes".
The class I am playing with is a custom class. I have no problem publishing, raising events, searching on property values, and so on. The only problem is when I am trying to modify a property.
I have 2 WMI classes, one to represent an object, and another one that is an event, to warn that a new object arrived.
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
How many time do I have to ask before you'll post the code?
|
|
|
|
|
ManagementBaseObject myObj = searcher.Get("MyId = \"someId\"");
emailObj.SetPropertyValue("MyProperty", false);
The searcher call works, the SetPropertyValue one does not.
I cannot post the complete code as it is somewhat complicated because the searcher is used in many places so it is created somewhere else. This goes for the ManagementScope object also.
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
This code is incomplete. The searcher returns its results into an object called myObj , but then does do anything with it. What is emailObj ?? How is it defined?? How does it get it's values??
On top of that, what does the code look like that defines this custom WMI class?? What creates it's instances??
Come on.... think!!! Getting something useful out of you to diagnose the problem is like pulling the teeth out of a Great White shark with a pair of tweezers! I'm not looking for the entire codebase, just the parts that define the objects and methods involved!
|
|
|
|
|
I cannot post the code for 2 reasons:
- It is too complicated, you would have to go through many pages, in many assemblies.
- I have signed an NDA which prevents me giving you complete code, or I can get sued.
Basically, it follows the following steps:
- I create a ManagementScope object and connect it. (this object is reused, is this the problem?)
- I create a ManagementObjectSearch object, giving it the ManagementScope object created earlier.
- I perform a search and get a ManagementBaseObject from it, on which I try to perform a SetPropertyValue that is not working.
So, do you know any reason why a the ManagementBaseObject.SetPropertyValue would not work? Do I have to do another step?
You know, if somebody would ask me "I am adding a row in a DataSet but it is not reflected in the database, what is wrong?" I wouldn't need the complete code from him to figure out that he did not save the DataSet.
Thanks for your answers, even if you try to make me look like a complete idiot.
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
Le Centriste wrote: It is too complicated, you would have to go through many pages, in many assemblies.
Le Centriste wrote: I have signed an NDA which prevents me giving you complete code, or I can get sued.
No, I wouldn't. I'm not asking for the complete code! Just the snippets that define the bloody objects involved!
How do I know the object class you wrote is decorated properly? I don't, and apparently, I can't find out. How do I know that the class exposes the WMI properties AS properties and not just public fields?? I don't, and again, I can't find out.
Le Centriste wrote: I create a ManagementScope object and connect it. (this object is reused, is this the problem?)
Nope. Scopes can be reused over and over. So can Searchers.
Le Centriste wrote: I perform a search and get a ManagementBaseObject from it
No, you don't. ManagementObjectSearcher.Get() returns a ManagementObjectCollection.
Le Centriste wrote: You know, if somebody would ask me "I am adding a row in a DataSet but it is not reflected in the database, what is wrong?" I wouldn't need the complete code from him to figure out that he did not save the DataSet.
For the 3rd time, I never asked you for the complete code!
|
|
|
|
|
Dave Kreskowiak wrote: No, you don't. ManagementObjectSearcher.Get() returns a ManagementObjectCollection.
Ok, I just take the first one, if the Count is superior to 0. I use GUIDs.
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
You're basically asking us to diagnose a problem with the engine of a car, be we're not allowed to lift the hood, try and start it, listen to it, plug a diag module into it, ... nothing. How on earth are we supposed to solve this problem??
About the only thing we can do is point you at a tons of examples so you can compare the "little black box" you have to the examples and see if you can figure out what's wrong. Here's[^] what you're comparing it to.
|
|
|
|
|
Everything is working, I publish ojbects, I get objects back, and all. I can search, my events work.
So, it must be working. I am just asking for the reasons why this is not working. Btw, I don't get any exception.
Basically what I am asking "Do you know any reason why the SetPropertyValue would not working?". I can read the property, but cannot set it. That is all.
Please, if you don't know the answer, don't post another reply making me look like I am stupid. I don't need that.
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
Le Centriste wrote: Basically what I am asking "Do you know any reason why the SetPropertyValue would not working?". I can read the property, but cannot set it. That is all.
Yes, about a dozen of them right off the top of my head. OK. We'll start with the most basic of problems.
Did you call the Put method on the ManagementObject after you called its SetPropertyValue ??
Le Centriste wrote: Please, if you don't know the answer,
How the hell is anyone supposed to know the answer?? Without seeing your code, we're all just guessing at what you got wrong or just plain missed!
|
|
|
|
|
I tried that, after casting the ManagementBaseObject to ManagementObject. I got a ManagementException saying that the provider does not implement this functionality.
I am starting to think that the default provider does not allow modifying properties.
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
Yep, that won't work. ManagementObject is outside the inheritence path of your class. Your class is a sister to ManagementObject.
Curious...why didn't you just inherit from ManagementObject in the first place?
|
|
|
|
|
I inherited from BaseObject, as the documentation says. It does not talk about anything else (except for events).
-----
Formerly MP(2)
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|