I'm looking at creating a helper method to set an exception's message, automatically setting String.Format, adding in inner exceptions, setting commandline exit codes, etc; something like:
public static void MyExceptionHelper(ExitCode code, string message) {}
public static void MyExceptionHelper(ExitCode code, Exception e) {}
public sta...
What classes should I use in C# in order to get information about a certain computer in my network? (Like who is logged on that computer, what Operating System is running on that computer, what ports are opened etc)
...
I have the below error message in my asp.net website when i replaced the textbox and put dropdown and named the dropdown id same as textbox id.
The value from the drop down should be taken and put in a email body and will be received as mail when i click on the submit button.
Below is the error i am getting when i click on the submit b...
In the DLR's LINQ Expressions, what is the difference between this:
Expression.Convert(SomeVariableExpression, typeof(T));
and this:
Expression.Unbox(SomeVariableExpression, typeof(T));
The documentation on this seems a bit sketchy.
And more to the point, which one of these is equivalent to this C# code:
(ClassA)InstanceOfClassB
...
I am dynamically adding a bunch of controls to a form. Each control calls the same method, and in that method I need to know the array index of the the control that performed the action.
CheckBox[] myCB = new CheckBox[100];
int i;
for (i = 0; i < 100; i++)
{
myCB[i] = new CheckBox();
myCB[i].Text = "Clicky!";
myCB[i].Click +...
I have the below error message in my asp.net website when i replaced the textbox and put dropdown and named the dropdown id same as textbox id.
The value from the drop down should be taken and put in a email body and will be received as mail when i click on the submit button.
Below is the error i am getting when i click on the submit b...
Hi,
I'm sending a message from my ASP.net page to an email account, the message is sent properly and is viewable in Thunderbird or any other email client I use.
But I can not view the message text in my Windows Mobile 6.1 (BlackJacK II) device, I've played around with setting
msg.BodyEncoding = System.Text.Encoding.Unicode;
or
...
I have a .NET project that uses Crystal Reports. The application is distributed using ClickOnce. Things work great if the user has Crystal installed on their computer. However, not all of the end users have Crystal Reports installed on their computers. These users are receiving the following error...
"Unable to install or run the ap...
I'm having difficulty with C#'s 'Dispose' pattern. I have 3 classes at play here: A management class, a form, and a data-storage class.
The management class may (if it needs to) use the form to prompt the user for input. The form loads data from a file, which the user can then modify. As it is closed, the form must save this data back. ...
I have a label in a WinForm.in the app, I create a thread for
setting the Text property of the label.
since the code responsible for setting the Text property of the
label is another thread, I wrote it like this :
private void SetLabel8Text(string text)
{
try
{
if (this.label8.InvokeRequired)
...
I am trying to select a value from a drop down control before it was text box. I have given the same ID for drop down which was similar to the text box.
Below is the code:
Do
counter=counter+1
tempPanelInputBox = form1.FindControl("txt_" + panelUsed + "_input" + counter.ToString())
Loop untill counter=CounterEnd
a...
What is the current feeling about the use of databound controls? When I first started using a RAD framework I remember many people on the message boards that I belonged to were very much against the use of databound controls.
IMO they greatly speed up development - but are they considered a good practice in the industry?
...
For instance:
Sorter.SortBy ( array, ( a, b ) =>
{
return a > b;
} );
What's the best way to format them for maximum readibility?
Also think of it for one parameter lambda version, and other cases that might be used commonly.
What are the guidelines?
...
Is there a simple way to get a system's uptime using C#?
...
I've heard there are (used to be?) ambiguous mappings between Unicode and SHIFT_JIS codes. This KB article somewhat proves this.
So the question is: will I lose any data if I take SHIFT_JIS-encoded text, convert it to Unicode and back?
Details: I'm talking about Windows (XP and on) and .NET (which in theory relies on NLS API).
...
I have a mixed Winform/WPF application which frequently throws the exception:
Could not load file or assembly <Full Assembly Name> or one of it's dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT 0x80131040) Error at object <Object Name> in markup file <file>.xaml
T...
Hi,
I have a C# application using C++ COM object both build on a 32 bit machine. Now I have to run them on a 64 bit machine. I registered the COM object. A corresponding entry was created in the register under computer\hkey_classes_root\wow6432node\clsid{xxx}.
However, when I try to run the application it says that |"Retrieving the COM ...
Hi there,
public enum Foos
{
A,
B,
C
}
Is there a way to loop through the possible values of Foo?
Basically?
foreach(Foo in Foos)
...
I'm doing an IE automation project using WatiN.
When a file to be downloaded is clicked, I get the following in the Internet Explorer Information bar:
To help protect your security,
Internet Explorer has blocked this
site from downloading files to you
computer.
In order to download the report, I can manually add the site to...
My office colleague told me today that is bad practice to use properties in interfaces. He red that in some MSDN article(s), which I couldn't find (well I was trying few times on google, probably with wrong key words). He also told me that only methods should be in interface.
Now, I am aware that is is not strict rule, since obviously in...