|
Cheese_kid wrote: n VB we can use context menu to click on it and goes to the next page we have sleclected.
Not in a web app, you don't.
Cheese_kid wrote: .But somehow, C# program doesn't have context menu
VB.NET and C# are both compiling to the CLR, and have pretty much the same capabilities in this area, they both use the same framework.
Cheese_kid wrote: was having problems of using javascript to design out the web page.
What do you mean by 'design out' ? What do you want to use jscript to do ? Javascript questions are probably best in the 'web development' forum.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Dear Experts,
My application is a Windows Service that uses FileSystemWatcher to monitor the file status of a particular folder location. As you know, FileSystemWatcher supports the following file events:
- Created
- Deleted
- Changed
- Renamed
That means, when a file is created, deleted, changed or renamed the FileSystemWatcher can detect and response.
Now the problem is the following:
1) I shutted down the above Windows Service for maintenance;
2) At this moment, files are being placed into the folder;
3) I started up the Windows Service again but the files (that are just placed into the folder)cannot be detected. This is because no created, deleted, changed or renamed events are given to FileSystemWatcher
4) My application is required to detect the existence of any files in the folder and to process them. How can I resolve this situation?
Could you please?
Many thanks.
Tigger
|
|
|
|
|
When your app closes, save the details of the files in the folder. When it opens again, do a manual compare before starting the watcher. The watcher quite plainly can only watch while it is running.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello Christian,
Thanks a lot for your advise. How can I obtain the file information inside a folder? What APIs should I use? Could you please tell me more about this?
Thanks again.
Tigger
|
|
|
|
|
System.IO.Directory.GetFiles
System.IO.File.Get....
You can enumerate the files, and get details like the last changed time from each.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
What is exactly happening when you go to run a program in Visual Studio.new C# console application. What's going on before your program shows up on the screen? What's happening in the computer itself when the program is being executed?
|
|
|
|
|
Read the EMCA and SDK tool developer docs, then you will know EXACTLY.
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
The executable is being created first, which means your code is compiled to MSIL. Then it's run, which means the framework is compiling that again, to something your PC can understand.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'm trying to call a com object method which I inherit in c#.net.
The com method signature is :
long GetBaseAssets(
[out] SAFEARRAY(BaseAssetInfo)* psaRecords,
[in, optional, defaultvalue(-1)] long BaseAssetCode);
and the clr create a reference for it as:
public virtual int GetBaseAssets ( out System.Array psaRecords , int BaseAssetCode )
The compiler says that argument 1 cannot convert from 'out taskbarlib.baseassetinfo[]' to 'out.system.array'.
The part in my c# class that calls the method looks like that:
BaseAssetInfo[] BaseAsset;
int intp;
rc = GetBaseAssets(out BaseAsset , intp);
Need your help,
Thanks.
|
|
|
|
|
try object[]
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
thanks for the prompt response.
I did, with not much success.
anyone has an idea ?
|
|
|
|
|
Seeing its an out parameter, try this:
Array input;
Foo(out input);
MyType[] rinput = input as MyType[];
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
I need help trying to open up a mysql database using Visual C#.
|
|
|
|
|
What have you already tried ? Google ? Searching this site ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
There's a very nice MySql Connector for .NET on the MySql.org website.
|
|
|
|
|
|
Ado.Net2.0 can enum most of metadata from database
Please pardon my weak English!
|
|
|
|
|
I am unable to see the source code for the first link that you provided. Are there any other suggestions or source code that anyone can provide me with?
|
|
|
|
|
I am trying to add an instantated class (which is an Object - I hope!) to an Arraylist every time the data in the class changes. This instantated object is composed of several other instantated classes (objects).
Example:
ArrayList myObj = new ArrayList();
class foo;
foo.strName = "name";
myObj.Add(foo);
...
foo.strName = "newname";
myObj.Add(foo);
When I look (via QuickWatch) at the Arraylist elements, they all appear to be the same, i.e.,
myObj[0] foo.strName == "newname" &&
myObj[1] foo.strName == "newname".
Yet, I know the data in the class has changed.
Am I doing something that is invalid? What am I doing wrong?
Thanks
|
|
|
|
|
You need to instantate a new object every time. If you just change a member of the object you still have the same object it doesn't automagically create a new object and it'll still be the same object that is already in your ArrayList.
|
|
|
|
|
hi there,
it sounds to me that u are adding only one object to array list.
and actually the reference to the object stored in the arraylist. So whenever u change it's attribute, all objectes in the arraylist will take affect, I think.
So the code should be:
class foo = new cfoo();
foo.strName="name";
obj.Add(foo);
....
foo = new cfoo();
...
obj.Add(foo);
Try it
<< >>
|
|
|
|
|
In your code, you did not instantiate a new foo object, instead you are modifying the foo.strName only.
An ArrayList stores reference to your object, therefore if you store two reference to the same object they will result in the same object.
Try this instead:
ArrayList myObj = new ArrayList();
ClassName foo = new ClassName();
foo.strName = "name";
myObj.Add(foo);
...
foo = new ClassName();
foo.strName = "newname";
myObj.Add(foo);
This will result in two different objects which references are contained in your myObj ArrayList.
Does that help?
Edbert P.
Sydney, Australia
-- modified at 18:58 Wednesday 26th October, 2005
|
|
|
|
|
Thanks to All,
My problem was not quite as simple as I showed in my example (i.e., I have multiple embedded classes involved), but all of you put me on the right track. I didn't realize that a reference to my class was what was put into the Arraylist.
I am able to do what I originally wanted, but had to do it a different way.
Thanks
Don
|
|
|
|
|
After a day of scratching my head, I think I've found the problem with my latest project, however I'm not sure what to do about it.
I've wrapped a legacy DLL with a .NET remoting solution that allows the functions to be accessed easily from ASP.NET. The DLL is used for reporting.
On my test system, with demo configuration and minimal data, everything worked fine.
At the clients site, where the reports are larger, the remoting service returns a null reference exception when the reports are over 4k.
Here is functions P/Invoke signature:
[DllImport("opsrpts.dll", CallingConvention=CallingConvention.Cdecl)]
static extern String DisplayReport(int rvc, int wsobj, int rptnum, int period, int scope, int reset, int range, int start, int end, int suppress);
and the C declaration:
extern "C" DLLIMP_DBI char* __cdecl DisplayReport(int rvc, int wsobj, int rptnum, int period, int scope, int reset, int range, int start, int end, int suppress)
I'm assuming that the attempt to append more than 4k in a single string operation blows something up somewhere. At this point it's the only logical explaination I have.
Is there any way other than modifying the report to get the larger reports back? Since there is no way to just take the char* and work with it, I can't think of a way other than changing the DLL to use multiple calls to pull the data back in chunks.
Thanks in advance!
|
|
|
|
|
Mark Tutt wrote: char* __cdecl DisplayReport
Shoot the person that wrote that function, shoot him dead. People like that should not be allowed behind a keyboard. Suggest to him in a nice way that he should join the police academy.
Alternatively if you run out of bullets, or dont have any handy, try the StringBuilder class instead.
The correct way would be to get the value for that char*, then do Marshal.PtrToString , then pray the person that wrote the DLL used the default malloc/free mechanism. PInvoke free() passing the char* to prevent memory leaks.
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|