|
Sharma Dinesh Kumar wrote: .net show me red line
No it doesn't. Visual Studio does. Behind the scenes, there's a fairly continuous parsing/compilation process going on out of process, and it is this that raises this. It's this process that provides the smart tag functionality to allow you to add the implementation of an interface or identify that a method is missing, etc.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
|
What? Elvis does this? I know he's the king, but that's just too cool.
"Your code does not compile. All hail to the king."
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
No. He left the building... to the elves.
|
|
|
|
|
Hi
I try debug my work in VS 2008 but PC and HTC WM6 (.NetF.work 3.5 installed) understand numbers diferently. First thing, number format in my region separated with coma 0,1.
What i cant get to work:
Test1 number in the textbox cosfi stored like us format 0.9 (not coma)
<br />
A.Text = System.Convert.ToString(Math.Round(System.Convert.ToDouble(cosfi.Text), 2) * 2);<br />
A.Text in PC test 1.8
In the phone i get error FormatExeption double.parse....
Test2 number in the textbox cosfi stored 0,9
A.Text in PC test 18
In the phone 1,8
<br />
A.Text = System.Convert.ToString(Math.Round(System.Convert.ToDouble(cosfi.Text.Replace(",", ".")), 2) * 2);<br />
With this metod all the same, PC give right answer 1.8 and phone give me error.
Can anyone help me out?
|
|
|
|
|
The chances are that your PC and phone are set to different locale. Your PC is set to work with '.' as a decimal separator, and your phone with ','
You can either set the PC and the phone to the same locale, or (if you must, because it will restrict where your App works) specifcy the locale when you do the conversion. See TryParse[^] which allows you to specify which locale you want the conversion done in.
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
First: PC and phone are both in same local.
Second: Both work in same separator.
Third: Compact.framework not suport TryParse
Fourth: I dont have this problem if i write app for pc in Visual Basic (comma separator return always right answer).
|
|
|
|
|
Mees Metsast wrote: First: PC and phone are both in same local.
You said the emulator (not the PC) and the phone work differently. The way you described, these two ARE set to different locales. You provided all the proof needed to establish that.
Mees Metsast wrote: Third: Compact.framework not suport TryParse
You don't have to use TryPrase . double.Parse also takes a IFormatProvider parameter that DOES work on .NET CF.
Mees Metsast wrote: Fourth: I dont have this problem if i write app for pc in Visual Basic (comma separator return always right answer).
There are no two ways about this. The problem you are facing is because of an incorrect locale setup on your test device, probably the emulator.
|
|
|
|
|
Sorry, this is my second app for phone and only now i get how this thing work (hard headed).
I tried to find a emulator settings under the VS2008 menu but this needs to be configured when it is running like normal phone (regional settings in the emulator itself).
Thank you for pointing right direction.
|
|
|
|
|
hi ...
WE are developed a windows based desktop application in c# . Now need to give license protection for that application. we are decided to give dongle license key . but have no idea about that . How can we achieve that ..please give the solution of these...
Thankyou!!!!
|
|
|
|
|
anishkannan wrote: How can we achieve that
Dongles are hardware keys - best thing would be to buy them, mostly you'll get a free booklet explaining how to interface with it. I'd suggest the USB-key dongles since you can stack those more easily than the parallel ones.
anishkannan wrote: please give the solution of these...
There you are[^]
I are Troll
|
|
|
|
|
Hi,
I am wondering if it is ok to use the following snippet ? I am suspecting that, as the object license will be disposed after this block, the caller of GetLicense method will get null object all the time, right ?
public virtual EncryptedLicense GetLicense(LicenseContext context, Assembly assembly, Type type)
{
..........
using (EncryptedLicense license = LoadLicense(context, null, licenseKey))
{
return license;
}
}
As my class EncryptedLicense is Disposable, my refactor tool (CodeRush and ReSharper) is asking me to place the statement EncryptedLicense license = LoadLicense(context, null, licenseKey) within using. But, I am getting worried if it is a correct practice or not. Would you please suggest!.
|
|
|
|
|
IMO, since you want to use your license code elsewhere, why do you want to put it in a using statement?
You are not going to call dispose() on it anyway.
|
|
|
|
|
Hi Abhinav,
Thanks for ur reply. So, that means, I should not use 'using' here, right ? I got the answer.
|
|
|
|
|
AFAIK, there is no point in you using using here.
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
When using a "using" construct, when execution leaves the "using" block for ANY reason, the object specified in the "using" block is Disposed and destroyed. You cannot return an object created in the "using" statement to any caller since it won't exist any more.
|
|
|
|
|
Thank you Dave, thats the answer I was looking for. I was confused about it, now I am clear.
|
|
|
|
|
I agree, however that also tells me the compiler should reject the code as it cannot possibly make sense.
|
|
|
|
|
Another one for MS to consider.
|
|
|
|
|
It can't figure it out because if license is declared before the using but not necessarily instantiated, it can still be used to instantiate another object after the using block.
|
|
|
|
|
Emran Hussain wrote: will get null object
No, not null, but it should be unusable -- however that depends on what the Dispose method actually does.
I write Dispose methods for a lot of things, not all of them leave the instance unusable.
|
|
|
|
|
Hi,
Thanks for your reply. I just started learning to use Dispose method and I am highly confused about one thing. WHY Microsoft created this new pattern when the Class Designer can put all memory cleaning logic in the Destructor of the class ? Because it is very easy to miss calling Dispose method for a new programmer and I have seen hundreds to source code where programmers are not calling dispose method or using 'using contruct' for Stream operations. Even in the popular open source library 'HtmlAgilityPack', I dont see the programmers are Calling Dispose method in Stream operations.
==> Also, I am wondering, even the Windows Form generated Code in Main method in Prgram.cs file in any Windows Application, the Entry Point Form is invoked without using 'using construct'. So, can you please give me any light about it please !
Regards.
|
|
|
|
|
To clean things up before the destructor gets called?
|
|
|
|
|
Dear Sirs,
I have a program that takes command-line arguments. The ordinary method of ingestion is drag-n-drop. So, you drag a (DICOM|*.dcm) file (or more) onto my program, it reads them and processes them without showing a form. No problem. A coworker pointed out today that the program doesn't work with "twelve or so" files. I tried it and can get 23 items to work, but adding the 24th screws it up. The error message is a simple msgbox saying:
"Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item." With the full path to the application in the title-bar.
My guess is that he was using rather deeply-nested or long-named files. I'm thinking what's happenning is that the shell is somehow not getting the program path correct with lots of parameters?? the parameters somehow obstructing the filename?? I checked it out and when I get the twenty-three items to work, the command-line length (with full program path) is 2,075 characters. Raymond[^] has lots to say about it, but my length isn't close to what he talks about: Nowhere near 32767, over 2048, and not near 8192, and well over the dos limit of 127.
I could do something creative if my program would just run, but it never gets to sub Main().
If anyone has had this problem before, please give me sympathy. Even better, if someone knows how to work around or fix this problem, please let me know!! I've searched the web for a while and nothing came up. I was sure to check this forum to avoid double-posting. Thanks!
Aaron
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
Raymond wrote: If you are using the ShellExecute/Ex function, then you become subject to the INTERNET_MAX_URL_LENGTH (around 2048) command line length limit imposed by the ShellExecute/Ex functions.
Think about it, dragging files from Explorer and dropping them onto your application requires something to start the application. I would venture to suggest that Explorer uses ShellExecute/Ex to do just that, hence the 2048 character limit.
It's time for a new signature.
|
|
|
|