-
- Accessing enclosing class members from a nested class.
by Hazem Elshabini
- 13 Replies
- Last post
by sirjis
- Hello,
i'm working on a project, i've faces a simple problem, i just wanna make sure i have the optimum solution.
i need to access encolsing class member from a nested class.
i tried different approaches, alot of them work...i need to know which is better.
Method 1: Using Inheritance:
Code Snippet
public class A
{
//this is the member.
pri
-
- I can't declare an enum
by Niklas912
- 4 Replies
- Last post
by nikov
- Hi, I got a problem every time I declare an enum with this code: using System; using System.Collections.Generic; using System.Text; namespace Hello_World { class Progrma { static void Main(string[] args) { enum Temperatures { WickedCold = 0, FreezingPoint = 32, LightJacketWeather = 60, BoilingPoint = 212 } } } } Every time I
-
- Passing Exception Details from a Windows Service
by TheMadMonk
- 2 Replies
- Last post
by TheMadMonk
- Hi all,
When I throw an exception from my OnStart() method in a Windows Service, the exception message pops up, but the text is garbled.
Its like:
"Could not start the Test service on Local Computer
Error 0xffffffff: 0xffffffff "
How can I make it show the string message I pass while constructing the exception, instead of 0xffffffff
Here's how I throw the exception
-
- C# Exchange Integration
by C Not So Sharp2
- 1 Replies
- Last post
by Ji Cheng Wang - MSFT
- I'm about to be a Project Manager on a project that requires a C# application read Calendar information from Outlook / Exchange and then update the Calendar with a new appointment. The application would have to also delete an existing appointment.
I will have to provide an estimate for this.
I'm looking for someone that has developed the necessary C# code around whatever API's Micros
-
- Worker or Thread Question
by Vitalijus
- 3 Replies
- Last post
by RizwanSharp
- Let's say i want to make custom control, let's say a button ;) But then my mouse is over that button, it changes from one color, to another, lets say in 5seconds. Creating thread, creating invoke methods, i think will take too much cpu time, and will work slow. I have heard, there is some such thing as worker, or pool worker, or something like that, what is difference between that, and thread.
-
- Not able to find the function name in the assembly through reflection.
by Pooja Katiyar
- 6 Replies
- Last post
by Pooja Katiyar
- Hi,
I have an interface and some functions inside it. I have a class which implements this interface and one function prints "Hello world." and one property returning one integer value. Now I have compiled this class into an assembly.
After this I have created one console application which loads this class and try to find out the function and property.
I am using this code.
Assembly a
-
- c# how to update point array using foreach loop
by J.C. Coelho
- 2 Replies
- Last post
by J.C. Coelho
- Hi there, I've done quite a bit of programming in J++ and even Java but am currently getting stuck trying to achieve things in C# :( My current situation as follows: I have a point array that's been initialised with the curly brackets. I then learnt to loop through it using foreach, here's the example Point[] pointarray = new Point[] { new Point(0, 0), ... }; foreach(Point p in pointarray) {
-
- copy data from 1 dimensional byte array to 2 dimensional byte array
by nattylife
- 1 Replies
- Last post
by Marcelo Guerra - MSFT
- if i have 2 byte arrays such as
byte[] s_temp_array = new byte[100]; byte[,] s_final_array = new byte[10,10];
is it possible to block copy s_temp_array into s_final_array and access s_final_array as a 2 dimensional array such as
Buffer.BlockCopy( s_temp_array , 0, s_final_array , 0, 100 );
or would i need to go through every offset and just do it manually like
Buffer.BlockCopy( s_te
-
- Event raised on a specific date or time
by andriscs
- 4 Replies
- Last post
by Bora Inc
- Hi, I'd like that my program would show messsage boxes on specific date or time. Is there a clever way to do it For example: the alarm is set to 10:00 on 20th of September. How can I have a message box that pops up that time I thougth about using a timer, but I guess it is resource wasting if I check in the Tick eventhandler of my program for the specified date or time in every second (or even mo
-
- who catches explicity thrown exception ?
by bilalso
- 10 Replies
- Last post
by Mark Dawson
- I have a question about the usage of throw in the following code I found on msdn. In this code, an excpetion is caught using try catch block and in the catch block it is rethrown using an explicit throw statement. My question is that who handles the explicitly thrown exception The same catch if this is the case then the compiler will be trapped infinitely inside the catch block. using System;
-
- Cast <IList>
by thukralz
- 11 Replies
- Last post
by Harsimrat
- I have something like this...
public static IList < AbstractKeyValueEntity <T>> Values<T>( ListBox listBox)
{
IList < AbstractKeyValueEntity <T>> results = new List < AbstractKeyValueEntity <T>>();
foreach ( ListItem item in listBox.Items)
{
if (item.Selected)
{
results.Add( AbstractKeyValueEntity <T>.GetLooku
-
- How do do this ( a constant value is expected )
by andrewcw
- 4 Replies
- Last post
by bretonne
- I had some constants that worked well in this switch statement. But a better design would be to use them as enum types, as follows, however now the switch cant compile.
public const string HWPARAMETER = "HWNOPARAMS" ; // I want to consolidate these in the enum
public enum ioTypes { MANUAL,VIRTUALCH,HWPARAMETER,HWNOPARAMS,TMSTIME}
private void Measurement
-
- How to connect a custom hardware
by Vikasumit
- 5 Replies
- Last post
by Vikasumit
- Hello,
I am looking to create a application, that will communicate to hardware that is connected to USB port. Actually our client has send us a hardware device, that has USB port that attach this hardware with computer system. Our new hardware has its own keys/button to press when our software application send singal to its LED or speakers.
Now what I want to figure out is that how can
-
- How to execute a dos command in C#?
by vincent90152900
- 2 Replies
- Last post
by vincent90152900
- How to execute a dos command in C# Many thanks for your replying.
Code Snippet
private void button1_Click(object sender, EventArgs e) { //code here please }
-
- Multi Threading Issue
by cohowap
- 4 Replies
- Last post
by TaylorMichaelL
- Hello,
I have a winforms app that creates a few threads. What the threads do is scan a memory location looking for a byte of data changes to flag an event. However, whenever more than 1 of these threads are created, the computer lags really bad. I was wondering if anyone knew of a better way to get the same results, while scanning multiple locations (near 10):
Here is some sample code
-
- How to suppress message 'My.Resource.Name' is not a valid identifier
by mountain traveller
- 4 Replies
- Last post
by mountain traveller
- The .NET Framework 2.0 help includes the guideline that internationalisation resource keys with a recognizable hierachy in .resx files should use names that represent the hierarchy with the different elements of the hierarchy separated by periods. In other words, they recommend naming resource keys something like:
Contacts.Person.Gender.Label
Visual Studio 2005 gives a warning in this case
-
- run outside (not included into web-page) JavaScript on page showed into webBrowser control
by vilog
- 1 Replies
- Last post
by Figo Fei - MSFT
- Hello All!
How can I run a custom JavaScript on page, that showed in webBrowser control
For example I have a follow code on JavaScript, and I want to run him in webBrowser1:
<SCRIPT LANGUAGE="JavaScript"> var selectedHtml=external.menuArguments.document.all.tags("HTML")[0].outerHTML;
if(selectedHtml!= "") external.menuArguments.clipboardData.setDat
-
- DllMain in C# ?
by Alexandre Eden
- 10 Replies
- Last post
by Alexandre Eden
- Hello,
I have an unmanaged C++ application that handle plugins. I'm trying to make it support managed plugins but I still have a problem. My C# dll gets loaded but it has to register to the main app. In C++ plugins it was done by calling a method in the Kernel, by defining a static variable or by using DllMain.
Is there any way to do that in C# When are static variables going to be i
-
- C# class' function members
by recherche
- 5 Replies
- Last post
by Peter Ritchie
- Howdy!
I'd like to know whether the following 4 C# class' function members can be static:
1. indexers 2. properties (From my reading, properties offer a streamlined way to manage access to a class' instance data but from my trial, properties work with static also. Perhaps convention or rule ) 3. events 4. operators
Yes or no, what is the significance
Thanks
-
- Generic Type Problem?
by Tech02
- 2 Replies
- Last post
by Pradeep C
- I typed the following code:
DirectoryEntry entry = core. DirectoryConfiguration .getUsersDirectoryEntry();
DirectorySearcher ds = new DirectorySearcher (entry, "(objectClass=user)" );
ds.SearchScope = SearchScope .OneLevel;
SearchResultCollection sr = ds.FindAll();
IEnumerator ie = sr.GetEnumerator();// compilation error occurs
The compilation
-
- Start Processes and monitor it.
by MielieSpoor
- 6 Replies
- Last post
by MielieSpoor
- Good evening,
I need to start a process from my C# app. I know I can use the process.start() method but the problem is that I need to know when that process has finished executing so that I can continue.
I need to know what the result was of the process so that I can determine what the next step should be. (I need to run installer files (msi's)).
Any ideas
-
- Working around "out of memory"
by gbereny
- 13 Replies
- Last post
by Peter Ritchie
- Hello, I have some C# code in an application that consists of C# and C++ code. The C# code I'm looking at calls the constructor for a Bitmap object if the user requests a particular operation. The C++ code also runs or not based on user-requested operations. The Bitmap constructor call sometimes generates an "out of memory" exception or on occasion, a "parameter not valid"
-
- get folder share permissions
by schewardnadse
- 5 Replies
- Last post
by Figo Fei - MSFT
- Hi,
I have a path and a userID - how can I find out if the file (path) is shared with the user (userIdentity)
In other words, how can I get information about the share permissions of a specific folder
Thanks,
Ralph
-
- Kill process
by &#38;&#35;169&
- 2 Replies
- Last post
by Timo S
- I
have a program which lists all the processes in my computer. Now the
problem is that if I use it in the computer where the user is not
administrator or he/she doesn't have enough rights, it's impossible to
close the process with Process.kill() method.. :/ Is there any other
way to close the process In that way that it doesn't care about any
rights or problems when I close that process
T
-
- How do you cast a char* to IntPtr?
by scarlette3000
- 7 Replies
- Last post
by scarlette3000
- How do you cast a char* to IntPtr
My code snippet looks like this:
unsafe { char * a = null; IntPtr result = &a; }
The second line is too obvious to fail. Any idea how to do it It is greatly appreciated.