|
yes i know.. but i want it to be on print page2 in the same position like page1.
Regards!!
|
|
|
|
|
In c#.net which namespace and classes and method use to control the hardware of my computer i,e i want to develop a c# program which can use for eject the cd rom of my computer without and manualy touch.if possible plz sent a demo program to understand the uses of namespace,classes and method .
|
|
|
|
|
You need to read up on how to ask questions. About C#.NET is not a worthwhile header.
There are namespaces that may help you, but I suspect you're going to end up pinvoking C APIs www.pinvoke.net[^] is a good place to start
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
Hi,
I have started looking at LINQ lately...
I can see that learning LINQ will indeed reduce the coding I do at present...
Questions:
1)
Do you think LINQ is the way forward? Will it be in demand in the near future?
2)
It's just that I do not see or hear any projects requiring the knowledge of LINQ.
So, should I really invest more time to learn LINQ? I do not miind doing this if I know it will be in demand...
Thanks
|
|
|
|
|
1 - LINQ is probably resume fodder, and will most likely be used for all sorts of things it's not good for, before things settle down and it just becomes a tool in the toolbox.
2 - I can't percieve of a project NEEDING LINQ. It's just syntactic sugar. There are good reasons not to use it ( one, if you're the only one on a team who can read the code ). But, I still am trying to carve out time to know it better and to be able to use it myself.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
For the most part, I agree with what Christian said.
1. LINQ is still very new and all of the guidance around when it should be used isn't in place yet. There is a lot of power and flexibility behind LINQ and the concepts taht are in place to support it, like extension methods and lambda expressions. Most of those language features will eventually just become another tool, in the same way foreach has.
2. There will never be a project that requires LINQ. Everything that can be accomplished using LINQ can be accomplished in more traditional manners as well, although it may be easier using LINQ or some of the LINQ related language features.
In my opinion, you're better off knowing how the supporting language features work (extension methods, lambdas, inferred typing, and object initializers) and what you can do with them. LINQ is a pretty big topic (LINQ to SQL, Entities, XML, etc...) but the supporting features are all the same no matter what.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Not really important, but I'm just curious.
Say that you want to print something to a log if a global boolean (condition) variable is set.
How would you do it?
1)
if(condition)<br />
CallLogMethod("Message");
OR
2)
CallLogMethod("Message");
and in the method body put
if(!condition)<br />
return;
The first makes the code more bloated if used intensively, while the second uses the call stack even though it might not do anything.
So how would you do it?
|
|
|
|
|
I'd go with 2. My dual core CPU can handle it. My number 1 priority is bug free code that's easy to use.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
There is a third option:
CallLogMethod(condition, "Message") The CallLogMethod still evaluates the condition, but it gets passed in. This is similar to how Debug.WriteLineIf works.
In either case, I would go with option 2 or 3 and push the test into the method itself. This way, you guarantee that it will always be tested and tested the same way and it's one less thing to worry about at the calling site.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Hi,
I'm using a PropertyGrid on my custom property class. I want to dynamicly set a property to ReadOnly or hide it.
How do I do this?
Gr.
|
|
|
|
|
[ReadOnly]
public bool Foo {get;set;}
[Browsable(false)]
public bool Bar {get;set;}
|
|
|
|
|
I'n not sure what I'm suppose to do here.
When I add [ReadOnly] to my property I get an error.
I tried something like [ReadOnly(Foo)] but that not allowed either.
Could you give me a bit more described answer.
Thanks
modified on Tuesday, July 1, 2008 4:28 AM
|
|
|
|
|
using System.ComponentModel;
[ReadOnly(true)]
or
[ReadOnly(false)]
|
|
|
|
|
Well I think i haven't been very clear.
I know this. But I want to change this Dynamicly. By that I mean I wan't to change this at runtime by clicking on a button or something.
|
|
|
|
|
Well you should flippen well ask that! And why vote me down when I gave you the correct answer for your original question?
The answer is you cant do that. (You can probably but that will require a lot of work, and I have not gone down that route).
|
|
|
|
|
Well sorry for voting you down but your answer wasn't verry complete and I thought the word Dynamicly made it pretty clear I wasn't looking for a static solution.
But we might disagree on that one.
Although I found a project in wich it is done (link[^]), this was way to complex for me so I'm using a workaround now.
Anyway thanks for your reply. and sorry again for the "down voting".
|
|
|
|
|
KBou wrote: Although I found a project in wich it is done (link[^]), this was way to complex for me so I'm using a workaround now.
That's what I thought
KBou wrote: I thought the word Dynamicly made it pretty clear I wasn't looking for a static solution.
Dynamic can mean a lot
KBou wrote: Anyway thanks for your reply. and sorry again for the "down voting".
No problem
|
|
|
|
|
hi every buddy,
I'm working in an ASP .NET project and in that I need to generate a unique key which is to be used instead of the primary key in the database of 6 digits and it should be random in nature yet it should be unique ofcourse. Actually the client doesnt want to issue numbers such as 000001, 000002... he wants it to be like 872731. The problem in my mind is that how are we gonna generate these unique but random numbers, coz whats bugging me is: WE would have to check for the keys already taken and 1) its v inefficient and 2) it could have problems with concurrency.
So I really need to guidelines from you people, I would definately appreciate this. Thank you.
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
Why do people insist on this anti-pattern?
You will likely need to persist all the id's in a table, then just create random number, check for uniqueness on table, repeat if necessary, add newly created number. For concurrency, you will probably need to lock the table or something.
|
|
|
|
|
leppie wrote: Why do people insist on this anti-pattern? [Frown]
hmm didnt get that one! honestly.
now comming to the point. I really dont think locking a table would be a great idea from an ASP .NET app. I may be wrong. Do u think I can generate the random numbers from TSQL?
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
|
yea well I had that in mind too but how will I convert that to a six digit number?
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
Ohh sorry. I haven't noticed the 6 digit requirement. You need follow what leppie said then. It will tough to make it reliable.
|
|
|
|
|
no its ok, but I'm still perplexed about locking the table from this asp .net app. I think it has the potential of bring the whole application to its knees!.
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
It will only lock the table while generating the number, that should take 10ms, so that should work unless you need to do this 100 times a seconds. And in that case 6 digits wont cover uniqueness, you will run out in 10 minutes. That's why it is an anti-pattern (just wrong from the start).
|
|
|
|