|
Thanks for the tip. I'll take a look at it.
A good programmer is someone who always looks both ways before crossing a one-way street. (Doug Linder)
|
|
|
|
|
Helfdane wrote: I can't access the sources from this machine and I'm not going to type it over
Post a relevant snippet demonstrating the problem when you do have access. I'm not going to hunt for something without a map.
Helfdane wrote: But if this was a logic-issue, I should have problems on all machines
Why? Some logical errors only become visible under specific circumstances.
Helfdane wrote: The only thing different between those machines is that the one machine which hangs the app has .net4.0 runtime installed, the others are still on 3.5.
Is the app also compiled against 4.0, or is it running on the 3.5 framework?
Are you by any chance using WM_NCHITTEST on the trayicon?
I are Troll
|
|
|
|
|
Hi,
In my application am providing the access to the user to export the data from Grid to Excel,
After exporting the data to excel, it will save that file in user desktop and providing a option to open the file in my application by displaying a message in message box...
My question is, suppose if the user dont have excel installed in his machine and he clicks on open the downloaded file through my application, it will through an exception..
In that occasion i have to display message to the user to install the required application before opening the machine, in case if he dont have that application in his machine...
So could u tell me, how to do it....
|
|
|
|
|
Check the registry. In HKEY_CLASSES_ROOT, there should be an entry for the extension, and one or more sub-keys for the "type" (e.g. ".xls" with sub-key "Excel.Sheet.8"). Then look at the key for "Excel.Sheet.8", you will should see a sub-key "Open" and there a sub-key "command". If one of those keys cannot be found, a suitable application is not (correctly) installed.
|
|
|
|
|
Hi,
Am using the below code to check whether the excel is present in user machine or not...
if (MessageBox.Show(
"Data Exported to File " + strFileName +
" at location MyDocuments. Do yo want to view the saved file?",
"Work Done",
MessageBoxButton.YesNo,
MessageBoxImage.Information) == MessageBoxResult.Yes)
{
Type officeType = Type.GetTypeFromProgID("Excel.Application");
if (officeType == null)
{
MessageBox.Show("Please Install MS Excel 2007 or above version to view this file", "Liquidity Risk Management");
}
else
{
oXl.Visible = true;
}
}
Now, suppose if the user having lesser version of excel like excel 2003,he can able to see the see the file downloaded under the version on excel 2007, means irrespective of the excel version, it has to open the file if the user have a excel installed in his machine..
How to do it...
|
|
|
|
|
Or you can show the Open with dialog box:
Process p = new Process();
p.StartInfo.FileName = "rundll32.exe";
p.StartInfo.Arguments = "Shell32.dll,OpenAs_RunDLL " + filename;
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
p.Start();
|
|
|
|
|
Hi all,
I am trying to execute this line of code but it not providing me the values
ManagementObjectSearcher pd = new ManagementObjectSearcher("SELECT Name, MediaType, MediaDescription from Win32_PhysicalMedia");
foreach (ManagementObject mp in pd.Get())
richTextBox3.Text += mp["Name"] + " " + mp["MediaType"] + " " + mp["MediaDescription"];
Can anybody please tell me what i am doing wrong or if i need to include something in this...
mainly i want to find media type...
Thanks in advance
|
|
|
|
|
Try "select * from Win32_PhysicalMedia" and see if that returns values. I'm surprised the code even compiles because mp["Name"] will return an object. Try. mp["Name"].ToString(), mp["MediaType"].ToString()...
Also don't forget to dispose of the ManagementObjectSearcher pd.
"You get that on the big jobs."
|
|
|
|
|
Hello Everybody,
I am trying to develop an application for Internet Access Watcher( URL Monitor).For that i am Listening socket.
it returns some data but i m not able to convert it read only (URL Address) format.
so please help...
byte[] input = BitConverter.GetBytes(1);
byte[] buffer = new byte[4096];
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);
s.Bind(new IPEndPoint(IPAddress.Parse("192.168.5.6"), 0));
s.IOControl(IOControlCode.ReceiveAll, input, null);
int bytes = 0;
do
{
bytes = s.Receive(buffer);
if (bytes > 0)
{
Console.WriteLine(Encoding.ASCII.GetString(buffer, 0, bytes));
}
} while (bytes > 0);
Thanks
If you can think then I Can.
|
|
|
|
|
eg_Anubhava wrote: it returns some data
What data? How do you expect anyone to figure out what you are receiving and what you expect to receive from reading the above?
I must get a clever new signature for 2011.
|
|
|
|
|
I want the URL which is currently displayed in browsers address bar.
Like : www.google.com
If you can think then I Can.
|
|
|
|
|
eg_Anubhava wrote: I want the URL which is currently displayed in browsers address bar.
Then I think you will have to hook into the browser and read the text out of that field. There are many articles on this process here on CodeProject.
I must get a clever new signature for 2011.
|
|
|
|
|
Since every browser has a different control layout and does not expose the same programming interface, if at all, you have no choice but to implement your own proxy server to monitor what each client is doing. Or, just use one off-the-shelf.
|
|
|
|
|
I have tested ToString() on a few decimal and it looks nice with no trailing zero, i.e.
1m.ToString() => 1
1.1m.ToString() => 1.1
1.0001m.ToString() => 1.0001
Yet, in my app, I have some decimal.ToString() looking like 5.00000000000000 (many useless trailing 0) which crops up all over the place!
Any idea as to why!?!
[Edit]
mmm.... in fact I was wrong! decimal store the number of decimal value it has been created with a display them!
i.e.
1.0m.ToString() => 1.0
(1.0m * 1.0m).ToString() => 1.00
User error, oops...
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Insufficient information! Show us the code and values that lead to your conclusion, and don't forget to include the relevant declarations.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
dunno, those decimal value come from the database!
mm... maybe I should check the values in the database...
but they do get displayed as "5.0000000000000000", anyway I just write a utility method which remove trailing 0
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
that is not the solution, as later on you will perform a search with a "WHERE field = 5" and the result set will not be what you expect. IMO when you have a problem you should try and understand and solve it, rather than hide it.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
mm.... there is some sense in that, let's roam this damn database!!!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Hey, by looking at the database I just got some idea!
while
1m.ToString() => 1
decimal.Parse("1.0000000").ToString() => 1.0000000
how strange....
but thankfully
1m == decimal.Parse("1.0000000") => true
mmm.... in fact I was wrong! decimal store the number of decimal value it has been created with a display them!
i.e.
1.0m.ToString() => 1.0
(1.0m * 1.0m).ToString() => 1.00
User error, oops...
but the conclusion: it's ok to remove the 0!!!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
So we both learned something today.
I tried a few things, and it seems the number of decimals can only increase.
When I multiply two numbers and show the result with ToString() I am getting (using decimal variables everywhere):
2 * 0.5 = 1.0
2.0 * 0.5 = 1.00
so multiplication adds the number of decimals of both multiplicands and propagates that to the product.
my conclusions would be:
1. there is a small difference between numbers, even when they have identical values (as in 1.0 and 1.00)
2. if you want to avoid all irrelevant trailing zeroes, you'd have to remove them explicitly.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Luc Pattyn wrote: so multiplication adds the number of decimals of both multiplicands and
propagates that to the product.
If memory serves me right it has to do with accuracy in physics when multiplying.
I should look that up when I have the time, but there was some logic behind it
V.
|
|
|
|
|
Super Lloyd wrote: Any idea as to why!?!
Because of the formatting of an imprecise type. Your doing calculations in your app with those decimals?
Look up the formatting-specifier on MSDN and use when appropriate. If you only want "a few", then specify that. Like "2".
I are Troll
|
|
|
|
|
I thought the whole point of decimal was to avoid this kind of problem!
I don't want to truncate to 2 number after the dot. I want to show the whole current value without any useless 0 (more user friendly).
Some of them are cents per litre, the user would be confused by calculations results if I remove some non zero digits!
Anyway, I "fixed" it, made a function to remove trailing '0'
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Super Lloyd wrote: I thought the whole point of decimal was to avoid this kind of problem!
Might be, but it still can't guess how much decimals you want. Hence, it'll probably take the one that "fits best".
Super Lloyd wrote: Anyway, I "fixed" it, made a function to remove trailing '0'
So, it might still result in a value of 1,0000001?
I are Troll
|
|
|
|
|
Eddy Vluggen wrote: So, it might still result in a value of 1,0000001?
Indeed!
I want no insignificant 0, but as many relevant number as possible!
Think accounting!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|