|
Hi guys,
I have created a Visual Studio setup project, and when I build it I get a .msi installer file. Does anyone know how to create a single .exe installer file, or how to convert a .msi file to an .exe file that can be downloaded? Thanks.
|
|
|
|
|
Why don't you want an .MSI?
|
|
|
|
|
Hi,
I have nothing against .msi files... I'm just wondering why every file I download off the web is .exe and never .msi, and if there is any advantage to using .exe. What do people use to create an .exe file?
Yigal
|
|
|
|
|
Hi,
When I create a context menu with C#, only the left button can select entries in the menu (AFTER the menu has been invoked by a right click). Does anyone know how to enable selection using the right button, like the way it is in most Windows applications?
Thanks.
|
|
|
|
|
I have found out why this happens: The way the context menu works depends on which control it's attached to. For example, when the context menu is attached to a text box, the various context menu click events are only invoked when the left mouse button is clicked; when the context menu is attached to a RichTextBox clicking any mouse button on a context menu selection works. Other controls I've tried: Panel, Label and Form, behave like a text box (only left button works).
Can anyone explain this inconsistency?
Yigal
|
|
|
|
|
I guess this question has been asked before, but I could not find any solution for it so here it is again:
How can I download gif-file from internet (URL) (using C# code)?
I want to use this function in a Pocket PC program that I am currently writing.
Thanks in advance!
Frank, Norway
|
|
|
|
|
have you attempted
Bitmap bm = new Bitmap(@"http://<absolute address="" of="" picture="">.gif");
|
|
|
|
|
you can do that?~?~!
/\ |_ E X E GG
|
|
|
|
|
It did not work.
I am trying to convert the "Threaded WebDownload class with Progress Call-backs" project to a SmartDevice project. It is working fine on the PC but it crashes when I run the application on the PPC (WM 2003). It seems to crash when this statment is excecuted :
DownloadThread dl = new DownloadThread();
I don't know why.
|
|
|
|
|
I have a string that contains some text. I want to check if the text can be converted into an integer. At the moment my code looks like this:
bool isInt = true;
try
{
int intValue = int.Parse(stringValue);
}
catch(Exception e)
{
isInt = false;
}
At the end of the code isInt will contain whether the string value can be converted to an int or not.
Is there a better way to do this? I don't like having to catch an exception when I expect that many string values will not be convertable to an int. It seems very inefficient.
|
|
|
|
|
It's the most secure way to convert a string to an int.
Why don't you put just all assignments into one single try-catch block?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Greeeg wrote:
Why don't you put just all assignments into one single try-catch block?
I don't want to convert it. This is part of some validation code. I just want to see if it is possible to convert it.
|
|
|
|
|
Since someone voted my previous reply a 3 I can only guess that I didn't explain myself very well.
I don't have multiple assignments. I only want to check one value and I only want to check if it is possible to convert it to an integer. I do not want to do an actual conversion.
If further explanation is needed, I'll be happy to explain more.
|
|
|
|
|
|
A double is no use to me. It will accept as valid values that are not valid integers. It is a pity, however, that there doesn't seem to be an equivalent for Int32.
|
|
|
|
|
I suggest you actually read the documentation.
There's a flag controlling what kind of numbers to parse.
mav
|
|
|
|
|
mav.northwind wrote:
I suggest you actually read the documentation.
I did read the documentation, but it does not explain on the TryParse page that it can be used to check integers. That is pretty useless documentation if you have to delve into sub-documents to find something that should have been at least mentioned on the first page even if there was no details about it.
Thank you for at least prodding me to read further because I did eventaully find the answer on this route. I hope you don't mind my little rant at the documentation. MSDN is usually very good.
|
|
|
|
|
Glad to hear you found the information.
The NumberStyles enumeration is in fact not explained on the page of TryParse, but that's the standard way MSDN is built. It's a separate type, so it's documented separately. With a proper link, though.
Anyway, once you actually have found the information you needed it's usually there where you'd expect it to be. But the location is only obvious _after_ you've found it, not when you're actually trying to find it
mav
|
|
|
|
|
|
I don't know how fast this is compared to the other options, but this way won't throw any exceptions, which are inefficient. Using regular expressions to validate input is a common practice:
bool isNumber = System.Text.RegularExpressions.Regex.IsMatch(stringValue, "[0-9]");
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Conversation With a Muslim
Judah Himango
|
|
|
|
|
But you have to be careful with regular expressions, since they are only testing what you think should be a valid int, not what really may be valid. For example, the regular expression you offered won't do too well on negative values.
Matt Gerrans
|
|
|
|
|
What would be better is just catching an InvalidCastException, instead of anything that may go wrong.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for your suggestion, I realise that I should only catch the specific case. However, I don't expect the failure of the conversion to be an exceptional case. I expect that the string does not conform regularly. That is why I didn't want to use a method that throws exceptions when the conversion fails.
I got an answer about Double.TryParse that returns a Boolean value and can be set to convert only integers that I'm going to use.
|
|
|
|
|
Andy MacAngus wrote:
However, I don't expect the failure of the conversion to be an exceptional case.
Exceptions don't mean you can only use them when they will rarely throw.
Andy MacAngus wrote:
Double.TryParse
Yeah, I thought there was something like that, but couldn't remember the details.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
Exceptions don't mean you can only use them when they will rarely throw.
What I mean is that exceptions are expensive and I expect that in the validation code I am writing that there will be a lot of bad data and I would like the validation code to work quickly.
|
|
|
|