-
- How to clear event binding automatically?
by ablmf
- 4 Replies
- Last post
by Peter Ritchie
- When object A bind it's method to object B's event, you can not delete A by just use :
A == null
GC won't collect A because A is referenced by B.
As A has bind it's methods to many events, it's very anoying to unbind them when I want to delete A.
Is there any better ways to solve this problem
-
- How to use List<T> with Generic Class Class<T>
by TerryMohre
- 7 Replies
- Last post
by Figo Fei - MSFT
- I would like to have a collection of the GenericT class
How
public class GenericT <T>
{
T t;
public T Thing
{
get { return t; }
set { t = value ; }
}
}
private void doThis()
{
List < GenericT <T>> list = new List < GenericT <T>>(); //I know this won't work
list.Add( new GenericT < string &
-
- Static method question
by CalvinR
- 3 Replies
- Last post
by Sean Hederman
- I have a question about static methods and there overhead, now in a project I'm working on I have to constantly do something now the code where I do this stuff is stored in an object, so I want to know if it would be better to instantiate an instance of this object once and then just call the methods normally or to declare the methods as static and call them that way. Now I would prefer to do it s
-
- Fastest data type
by Azurewrath
- 2 Replies
- Last post
by Azurewrath
- Hi, I am using a scripting language from another app to pass some values to a C# method. I am using a float array, but I was wondering if there is a faster data type that would help me speed up allocating the elements, etc Right now I am passing 20 elements at a time from the app to a C# array which fills the C# array. Thanks, Aw
-
- Can't find scribble source
by Codie Codemonkey
- 6 Replies
- Last post
by Haikun Zhang
- I've spent a frustrating evening trying to locate the C# source for the scribble tutorial. If you search for "scribble" in MSDN you can find a link that describes how to build it, but there is no link to the source code itself. Does anyone know how to get it
-
- C# COM entry point function
by George2
- 4 Replies
- Last post
by George2
- Hello everyone,
I am a developer from C++ COM to C# COM. I feel confused about the entry point function for a C# COM object.
In C++, we always initialize object through GetClassObject or DLLGetClassObject, but it seems C# does not need these functions
Here is a sample from MSDN.
http://msdn2.microsoft.com/en-us/library/aa645738(VS.71).aspx
So, in C# do we need to implement t
-
- Logging onto the interactive desktop when no one is logged on...
by KRMS
- 2 Replies
- Last post
by Chris Dunaway
- I have a suite of test tools that run when no one is logged on to the
machine. They do a variety of tests, like validating Office documents and a
variety of other things, including opening IE and attemting to download
content. When logged in, they run fine. But when I run the test automation
as a scheduled task, it fails because IE cannot be opened in a headless
environment. I have tried
-
- Stuck on 1st program in C# book!!!
by wysewyg
- 6 Replies
- Last post
by wysewyg
- I am using the .NET framework to write and run the example programs in the Programming in the Key of C# book. My first program is this one:
{
static void Main()
{
int ChildTkts, AdultTkts, TotalTkts;
ChildTkts = 3;
AdultTkts = 2;
TotalTkts = ChildTkts + AdultTkts;
}
It compiles just fine, but when I run it (Debug | Start Without Debugging) nothing happens.
-
- If condition
by Azurewrath
- 14 Replies
- Last post
by CalvinR
- Hi,
In the book I am reading it shows examples like this:
if (!SourceFileExists()) return;
System.IO. File .Copy(txtSource.Text, txtDestination.text);
MessageBox .Show( "The file has been successfully copied." );
Isn't it better to write it like this:
if (SourceFileExists())
{
System.IO. File .Copy(txtSource.Text, txtDestination.text);
MessageBox .S
-
- Catch (Exception e) - Get rid of warning
by Keren S
- 14 Replies
- Last post
by Keren S
- Hello!
Quit a few times in my code I catch an exception parameter that I have nothing to do with:
try
{
}
Catch (Exception e)
{
DisplayErrorMsg("Failed...");
}
The problem is that when compling, every such line creates a warning "The variable e is declared but never used". How do I get rid of those warning messages
I tried to
-
- How do you REMOVE or DELETE Items from Recent Projects list in VS2005 RC?
by yousaid
- 14 Replies
- Last post
by Martin Koster
- I have been testing VS2005 RC and as a result, I have built many applications. Most I am no longer interested in or use and would like to DELETE them from the RECENT Projects list, but I dont see how ! I have been achieving this by manualy deleting the project from IIS, but there's got to be a better way ! Any ideas cheers, yousaid
-
- Inherited Data Members
by pjzuber
- 7 Replies
- Last post
by pjzuber
- I have a question regarding inherited arrays. In my program I have an array of strings(protected) in my parent class. In a child class, while i have access to the array variable, all of the data in the array is missing. Is this normal procedure for c# What's strange is that while the data is missing when calling the variable directly, if i pass the variable from the parent class to the child clas
-
- c# Boxing Question
by mikeswill
- 3 Replies
- Last post
by Martin Platt
- I have a question regarding boxing in c#. Currently, I have the need for a map like the following:
Code Snippet Dictionary<string, FieldValue>
Where field value looks something like this (i'm leaving out obvious code ):
Code Snippet struct FieldValue { public object DataValue {...} public UnitType Units{...} }
It has come to my attention that the majo
-
- Problem stopping windows service when windows stops
by szozs
- 1 Replies
- Last post
by Biche
- Hi, I've been reading forums since 3 month now, and still can't get a real normaly structured information or source code about how to write a normal service which can do what I want. Anyway I somehow figured out some things, but I still cannot find the solution how to stop my service when I shut down my machine.
It starts automaticly becasue it has been installed as local system and automatic s
-
- STA Threads and Dialogs
by John Wesley Harding
- 9 Replies
- Last post
by 21 Concepts
- I have a service which runs on a Vista machine and has a number of other projects as part of the same solution, which are applications, dll's etc in their own right but the service controls them via code and therefore is referenced neccesarily. All of this works fine but the problem is for instance, when the service fire's up a new instance of an application and the application executes code which
-
- Intellisense can's see XML comments when 2-dimensional array is present
by Paul Hirose
- 5 Replies
- Last post
by Figo Fei - MSFT
- I ran into a problem with Intellisense not seeing the XML comments on some (but not all) of my methods. It appears that this happens whenever a 2-dimensional array is in the argument list. For example, if I compile the code below into a DLL, then call that method in another solution, Intellisense doesn't show my XML comments. However, another method in that class does the same thing except that it
-
- define a property which accepts a parameter
by papadi
- 14 Replies
- Last post
by boban.s
- Hello!
What's the C# syntax to define a property which accepts parameters. The VB syntax whould be:
Public ReadOnly Property Item(ByVal index As Integer) As Object Get Return CType(Me.List.Item(index), MemberDataValidationError) End Get End Property
-
- Two folders : Bin and Obj....Does anyone know why...?
by Tango-Charlie
- 7 Replies
- Last post
by DavidDwyer
- Hi guys, I had a very basic question.
When we compile VS 2005 C# appliation, it creates two folder. One is Bin folder and other one is Obj folder . Doe any one know why it creates Obj folder....I tried to find out the docs for it but could not find it....
-
- Special Setting?
by cybercrypt13
- 2 Replies
- Last post
by Figo Fei - MSFT
- I have VS 2005 with patch applied. I am working on an ASP.Net app and was watching a video clip where the guy clicked on a .css file that was part of the solution and dropped it inside his html file and VS pasted the code to include the file. I also watched him drag a component and drop it in the html file and it pasted the code for the control.
When I click and drag a css file or component
-
- How to send data to a field in explorer?
by Steve Cronk
- 6 Replies
- Last post
by Steve Cronk
- Hello,
I am building an application that works alongside explorer. The application generates some data that I then need to enter into som text fields on an explorer page. The application itself is currently in c# but this element could be rewritten in a different language. I am currently using Sendkeys but this relies on the windo having the focus, which I can;t guarentee, so I woudl like to fi
-
- PInvoke signature verification
by gudguy
- 1 Replies
- Last post
by Ji Cheng Wang - MSFT
- Is my PInvoke signature below correct here's the C++ header declaration: typedef struct tagVBOBJLOC { int nLeft; int nRight; int nUp; int nDown; } VBOBJLOC; typedef struct tagVBAFILTER { int nLevel; /* Current frame level (0-100) */ int nConfig; /* ACF flag = nConfig & 0x80, Threshold Level (0-100) = nConfig & 0x7F */ } VBAFILTER; typedef struct tagVBVIDAUXDATA {
-
- Event Firing
by tobriain
- 2 Replies
- Last post
by tobriain
- Hello, I hope one of you have found a solution to the following problem before. . . Thanks in advance if you have. I'm receiving events from an external dll (an RTDServer - set up like an observer pattern), and i've a Notify method that's called when there's an update to be collected. I can then collect a System.Array with a list of updates on a separate thread. The problem is that the list wil
-
- Interfaces oversold???
by IS dude
- 14 Replies
- Last post
by Mark Benningfield
- First, I must admit that I am a C# novice and so I probably don¡¯t have as much knowledge and experience on the subject of interface as most of you guys reading this post.
After reading a few books on C# and interface design, I still can¡¯t see and understand the real power of interface unless of course, we are talking about interfaces as a powerful concept in OOP ¡®only¡¯ and not as a powerful c
-
- C# code to return datetime using function
by JJ John
- 6 Replies
- Last post
by ImDaFrEaK
- I am looking for C# code for the following requirement.
enum dayofWeek
{ Sunday,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday
}
enum indexofWeek
{ first=1,
second=2,
third=3,
fourth=4,
fifth=5
}
I am looking for code that would return the date(individual part of date like month, year, day is passed as input to the function
-
- Accessing components created during runtime
by CEMc
- 3 Replies
- Last post
by Sanophy
- I am creating multiple labels during runtime and giving them specific names. How do I use these names to access the values related to each label.
For instance, I create 20 labels entitled Player##, where ## is a number from 00 through 99. I then want to change the Visible or Enabled properties of these labels that have names, preferably by doing something along the lines of ("Player"+