|
I already has castle.net as aop
|
|
|
|
|
I've use Phil Laureano's LinFu to do this type of thing.
|
|
|
|
|
Hi All,
1. Do you know if I can (and how) create an alias to the sql server via code ? what objects do I use and how ?
2. Can I configure the sql server remote access control via code (TCP/IP and name pipes) ?
Thanks
|
|
|
|
|
|
Hi Mika, thanks for your reply.
The configuration part is what I was looking for.
Regarding the alias:
In the SQL Tools -> SQL Server configuration manager ->
under SQL Native client configuration
you can create new alias to a server.
How can I do it using code ?
Thanks
|
|
|
|
|
|
Thanks !!! Works like a charm.
|
|
|
|
|
No problem
|
|
|
|
|
Hi,
I am developing a Windows Form Application using C# in Visual Studio 2008.
I have developed a form with menu strip, and now there are five different type of screens in File-> New-> I have them listed, but i am not sure how to have 5 different screens based on user choice.
Do i need to create five different forms? How can I then embed that in the main Form window?
Thanks a lot for your help
Karmendra
|
|
|
|
|
Have a FormLevel variable containing which option is clicked and accordingly make Controls Visble/Invisble on the form,or create Dynamic controls and add them to the form .
|
|
|
|
|
Use your main form as a form conteiner ok? or create 5 usercontrols and use them as pages you know? here you will have to use delegates because you can´t acess the usercontrols, just main form can acess them because is his parent.
So, if you like use main form like a form conteiner and load the other 4 forms inside him ok?
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
This isn't really something I need help on, but more wondering why or which way is better from asking experienced programmers.
Request.QueryString["..."];
or
Request.QueryString.Get("....");
Is there a reason for both of them? Does using the .Get save it time from not having to realize it needs to "Get" the query string? Just a silly question that has been bugging me so I've decided to ask.
|
|
|
|
|
There is no difference. The Item property get method (that you use in the first case) just calls the Get method.
The reason that both exists is probably to support programming languages that can not use an indexer (the first alternative).
Another alternative to get the values is the GetValues method, and that one is different. It returns the values as a string array instead of concatenating them together as a comma separated list.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Excellent. Thank you. Just something I've been wondering about. Thanks again!
|
|
|
|
|
Hii all..
I am creating a small application that supposed to monitor printing activities. I used Win32_PrintJob and successfully get the informations of printing process such as DocumentsName, PagesPrinted,TotalPages,Size,etc.
I store these values into database as printer log.
But, I have some difficulties in getting the bytes of printed files. Is it possible to do that using Win32_PrintJob?
I want to get these bytes to store it into database, so that the admin can see the content of printed files in the next time.
Thanks before for the answers.
|
|
|
|
|
I don't think there's an easy way to get the print job bytes using WMI. Try another, faster approach. Get every print queue using the LocalPrintServer.GetPrintQueues() method, iterate from 0 to the return value of the PrintQueue.NumberOfJobs property of the individual print queue, and use the returned PrintSystemJobInfo class from the PrintQueue.GetJob() method. There should be a PrintSystemJobInfo.JobStream property which will give you the stream of the job's data. All of these can be found in the System.Printing namespace, which you need to add a reference to (ignore what the MSDN page says about Vista, it works on XP just as well)
|
|
|
|
|
1 LocalPrintServer lps = new LocalPrintServer();
2 PrintQueueCollection pqc = lps.GetPrintQueues();
3 PrintSystemJobInfo pj;
4 foreach (PrintQueue pq in pqc)
5 {
6 pj = pq.GetJob(pq.NumberOfJobs);
7
8 }
As u sugggested, I create above code. But, I get an error at 6 line. With error description "Value cannot be null. Parameter name: printingHandler".
Do you have some suggestion? Or could you give me simple code that show your suggestion will work.
Thanks...
|
|
|
|
|
private PrintSystemJobInfo GetInfo()
{
LocalPrintServer localPrintServer = new LocalPrintServer();
PrintQueue q = LocalPrintServer.GetDefaultPrintQueue();
q.Refresh();
foreach (PrintSystemJobInfo pj in q.GetPrintJobInfoCollection())
{
return pj;
}
return null;
}
PrintSystemJobInfo pj = GetInfo();
int len = pj.JobStream.Length;
I use Windows XP Sp2
When executing len = pj.JobStream.Length an error occur "Object reference not set to an instance of an object."
Is JobStream works in XP? Because I read that it works on vista only.
|
|
|
|
|
If it only worked in Vista, then a different exception would have been thrown. As it is, you seem to be dropping past the foreach() for some reason. You do have something printing, even if only to a dummy printer, which isn't connected to the computer?
On the other point, I looked through the System.Printing.PrintQueue class with Reflector, and there doesn't seem to be any code which checks if you're running Vista, unless it relies on some new APIs, but I haven't seen any
|
|
|
|
|
I use both of connected printer and dummy printer. but the PrintSystemJobInfo.JobStream always return null . Any suggestion?
|
|
|
|
|
There is nothing which could cause the JobStream property to return null. Try something like this for the GetInfo() method of yours:
private PrintSystemJobInfo GetInfo()
{
LocalPrintServer localPrintServer = new LocalPrintServer();
PrintQueue q = LocalPrintServer.GetDefaultPrintQueue();
for(int i = 0; i < q.NumberOfJobs; i++)
{
return q.GetJob(i);
}
return null;
}
On the off chance, step through the code and check the NumberOfJobs property. Is it set to zero?
|
|
|
|
|
I've tried your code. When I executing the return q.GetJob(i);, it apprears error :
"An exception occurred while creating print job information. Check inner exception for details."
I search the inner exception, and found "Object reference not set to an instance of an object."
In my previous code:
private PrintSystemJobInfo GetInfo()
{
LocalPrintServer localPrintServer = new LocalPrintServer();
PrintQueue q = LocalPrintServer.GetDefaultPrintQueue();
q.Refresh();
foreach (PrintSystemJobInfo pj in q.GetPrintJobInfoCollection())
{
return pj;
}
return null;
}
PrintSystemJobInfo pj = GetInfo();
From pj I can get the printing information such as DocumentName and NumberOfPage. But when I try to get value from of JobStream, the error "Object reference not set to an instance of an object." apprears. Seems that the value of stream is null.
|
|
|
|
|
There's only one thing more that I can think of. Stick with your original GetInfo() and after you get the PrintSystemJobInfo returned by GetInfo(), call the Refresh() method before you access the JobStream property. Something like this:
PrintSystemJobInfo pj = GetInfo();
pj.Refresh();
Console.WriteLine(pj.JobStream == null);
If that doesn't work, then I don't know of any other method to do what you originally intended
|
|
|
|
|
Hi all
Now i finished My program, got it's EXE works.
is there is any way to get the code from EXE
and how to protect my EXE from this
Thank you..
|
|
|
|
|
mutafa81 wrote: is there is any way to get the code from EXE
Yes - you can disassemble the code.
mutafa81 wrote: and how to protect my EXE from this
You might want to try an obfuscator. It won't stop you getting the cod out, but it will make it bloody hard to read.
|
|
|
|