|
At some point you've got to cast your aspersions upon something unidentifiable and today I was just exercising an old CP trick to see whether I could auspiciously peg the post that caused the ticker on the front page to make that sound ...
Guess I'm not lucky because it wasn't this umteenth page.
|
|
|
|
|
I agree with what OG said. I want to add you should reconsider using a 3D array. In a lot of situations, a multi-dimensional array is not really needed.
Also, do all elements contain meaningful data, or is a majority of them just empty? If a lot are empty, switching from a structure to a reference type is advantageous. And if all or most full, is there a major axis? you may want to consider jagged arrays (e.g. a 1D array of 2D arrays, each with smaller sizes)?
If you need more help, explaining what it is about would be a good start.
|
|
|
|
|
Hello,
Presently I we have a VBA application.
1. We have scheduled tasks using Scheduled Tasks under System Tools.
2. The Schedule task opens a xlsm file and inside the Workbook_Open() method I call some procedures.
For Example:
Private Sub Workbook_Open()
MyMethod()
End Sub
3. The user does not need to interact with the application.
Now the company wants to convert the VBA application to .NET Application. I do not know what kind of application to choose from the following:
1. ASP.WEB Application
2. Windows Application
3. Windows Service Application
4. Console Applications.
Kindly Advice.
Thanks.
|
|
|
|
|
i think that if the user doesn't need to interact with the application, and the work can be scheduled, the better choice would be Windows Service Application, but, if you'll need to be able to start the process by hand at any time, i think console application is more straightforward to you and to the person that will use your application...
what type are your vba application? it's an excell macro?
|
|
|
|
|
What does your company, or your boss, or whoever, think they will gain by converting it ? Is there some functionality that is going to be added ... now, or in the future ... to the existing solution; or is some data or "report" going to be "sent out" or "published" in a way that is not happening now ?
If there are new requirements, I think we can better respond to your scenario if we know what they are.
best, Bill
"It is the mark of an educated mind to be able to entertain a thought without accepting it." Aristotle
modified 8-Jan-12 5:47am.
|
|
|
|
|
I agree with Bill. "If it ain't broken, don't fix it"
My choice would be to create a service and dump the scheduled task altogether. I can't remember why now but I've had problems with scheduled tasks in the past.
The service could monitor for a given event, time, file added, updated etc.
"You get that on the big jobs."
|
|
|
|
|
How often does it run? If fairly often, then a Windows Service; if not, console.
|
|
|
|
|
hi,
i am working on a USB HID KEYBOARD device. i want to register the device for the notification whenever it gets attached and removed from the system. i want to register it for all windows operating system(for all 32 and 64 bits) starting from XP.
it's a proximity device. User configures the keystrokes from the application provided with the device. As soon as user gets away from the range of the device, the device fires the keystrokes that were configured and saved by the user in the device. The device don't have any keys in it. It just fires the keystrokes configured and saved in it. The device has just the sensor in it.
can anyone provide me the solution how to do register the device?? i am using HID.dll, SETUPAPI.dll and kernel32.dll for this purpose.
|
|
|
|
|
|
using CodeDomProvider, you can compile without running the new code (yielding a CompilerResults), as well as run it without recompiling it (using CompilerResults.CompiledAssembly).
|
|
|
|
|
thank you for your answer.
I know how to create the CompilerResults and how to call a special method of the CompilerResults.
but I want to call a method as if no other method was called before it.
if I call a method of the assembly, for example foo(), which changes a static variable a, i want to call an other method, for example bar(), which is not affected of the change of the value of the static variable a.
do you know, what I mean. sorry for my bad english.
|
|
|
|
|
The statics of a class are executed once, at the first reference to said class. You can't undo that without unloading the class. The whole purpose of statics is to execute once.
And you can't unload a class, the only relevant thing you can unload is an AppDomain. So if you need a fresh class, you could load it in a separate AppDomain, use it, then unload the AppDomain. And again and again.
|
|
|
|
|
thank you very much for your help.
I'm going to try it
|
|
|
|
|
i created a list<string[]> and added data to it
List<string[]> dataArray = new List<string[]>();
dataArray.Add(new string[] { "start", "end" });
dataArray.Add(new string[] { "start2","end2" });
dataArray.Add(new string[] { "start3", "end3" });
now i want to delete the string[] containing {"start2","end2"} how to do it using built in functions like contains,find or by any other methods ?
when i tried following ....
List<String> Key = new List<String> { "start2","end2" };
dataArray.RemoveAll(k => k.Contains(Key));
getting an error :Compiler Error CS0411
The type arguments for method 'method' cannot be inferred from the usage. Try specifying the type arguments explicitly.
can any one help ????
JANARDHAN
|
|
|
|
|
Hi ,
As the elements in the list item are string arrays, you cannot use the contains keyword to compare.
Use the below code,
List<String> Key = new List<String> { "start", "end" };
dataArray.RemoveAll(item => Enumerable.SequenceEqual(item, Key));
Hope this solves the problem.
-Manognya
__________________________________________________
$ God gives what is best.Not what all you wish
|
|
|
|
|
|
Also, item in 'dataArray.RemoveAll(item => Enumerable.SequenceEqual(item, Key));' specified to represent the item in the list and not a variable.
-Manognya
__________________________________________________
$ God gives what is best.Not what all you wish
|
|
|
|
|
+5 Great answer !
best, Bill
"It is the mark of an educated mind to be able to entertain a thought without accepting it." Aristotle
|
|
|
|
|
Thanks bill
-Manognya
__________________________________________________
$ God gives what is best.Not what all you wish
|
|
|
|
|
You can't remove using dataArray.Remove(new string[] { "start2","end2" }); as that new array isn't the same as the original one.
However I see three ways, each taking some additional code:
1.
keep a reference to the item you will want to remove later on:
...
string[] toBeDeletedLater=new string[] { "start2","end2" };
dataArray.Add(toBeDeletedLater);
...
dataArray.Remove(toBeDeletedLater);
2.
remember the index in the list, then use RemoveAt()
int toBeDeletedLater=dataArray.Count;
dataArray.Add(new string[] { "start2","end2" });
...
dataArray.RemoveAt(toBeDeletedLater);
This will fail if other list operations cause the indexes to change...
3.
locate the element you want to delete (worst case: iterate and check the content of each element), then call RemoveAt.
|
|
|
|
|
|
it's because of the compiler generated types, that have no relation with each other, says that for List<UsingGenericInterface> the compiler generates the type ListUsingGenericInterface and for List<IGenericInterface> they generates the type ListIGenericInterface . the types have no relation with each other and, although the ListIGenericInterface can have the same items than the ListUsingGenericInterface , they are not the same type, so they can't be assigned without a conversion, the compiler doesn't know about the interchangeability, so they doesn't generate one
sorry if my answer aren't so comprehensive, its because i'm a brasiliam and my english is poor
|
|
|
|
|
|
take a look at the List<T>
declaration:
public class List<T> : IList<T>, ICollection<T>,
IEnumerable<T>, IList, ICollection, IEnumerable
i guess that the compiler generates a interface from IEnumerable<IGenericInterface> and makes all types generated for types that implement IGenericInterface implement that interface, so they are interchangeable.
think like this:
you have a Class A that implements interface I, and a Class B that also implements that interface, you can't write:
A a = new A();
B b = new B();
a = b;
because, although they implement the same interface, they are not the same type.
i think the same concept can be applied to List<A> and List<I>, they are both types that implement IEnumerable<I>, but aren't the same type.
what i really need to search more it's this case:
public IList<IGenericInterface> GetStuff()
{
return new List<UsingGenericInterface>();
}
at this moment, i can't explain why it didn't work, but i'll discover
EDIT: i've forgotten about the < and >
|
|
|
|
|
One other reason not mentioned is that returning IEnumerable or IEnumerable<T> is a requirement for using iterator blocks (yield keyword) .
|
|
|
|