Answer Questions
Gurpreet Singh Gill Objects and implement IDisposable being used in static classes
Hi I have an object which implements IDisposable. As a result of this, anywhere it's used I'm disposing of it. However, in a few instances it is declared as a member variable in a static class. Since static classes cannot implement interfaces I can't implement IDisposable on the static class and dispose of the object there. Also, static classes can't have finalizers so I can't dispose of the object in there. Is there a way to do safely dispose of the object in the static class Or, do I even need to worry about it since the static class will live for the lifetime of the AppDomain and disposable object will be destroyed when the static class is reclaimed anyway Thanks! Jeremy Hi Jeremy This is really a tough thing to ...Show All
VenezuelaRuth Windows Service or Scheduled Task
Dear All, I need to run particular database script every 20 minutes. So what should I be doing I am confuse between windows service and scheduled task. Which is better .net sukbir wrote: Dear Gabriel, I guess my choice wil be windos service cause I may later need to run this script on several different machines. Can you tell me where can I get a good reference to start off with my windows service application for my database script. http://msdn2.microsoft.com/en-us/library/zt39148a(VS.80).aspx Anyway if its only purpose is to run every 20 minutes the first thing I would think off is to use the task scheduler. .net sukbir wrote: Dear Gabr ...Show All
stephane - Montpellier Method Value 16
Hi all, I'm trying to converting a piece of source code from C++ to C#. But i don't have any idea what this method for: m_source is an unsigned char pointer and already point to some of unsigned char array. C++: inline unsigned short MSufSort::Value16(unsigned int sourceIndex) { if (sourceIndex < m_sourceLengthMinusOne) { return *(unsigned short*)(m_source + sourceIndex); } else { return m_source[sourceIndex]; } } i then converting to C#: unsafe ushort Value16(uint sourceIndex, char* m_source) { if (sourceIndex < m_sourceLengthMinusOne) { return *(ushort*)(m_source + sourceIndex); } else { return m_source[sourceIndex]; } } The result ...Show All
erfg1 HELP!!! Unresponsive keys in IDE! All of the special keys, including ENTER, DELETE, Arrows, etc! Very weird!!!
I'm getting nuts with this! Suddenly, 2 days ago, my Visual Studio IDE stop responding to any control key (Enter, Insert, Delete, the Arrows, Home, End, Page Up, Page Down, all of them!), but still types in any other alphanumeric key (including the numbers in the keypad with NumLock on) Obviously this makes editing impossible, and is making me go out of my mind! This happens with any file type, in any language, even txt files, but only in Visual Studio’s IDE (even god old Notepad behaves perfectly normal and recognizes all keys) I’ve already done everything I could think of, including uninstalling and reinstalling Visual Studio several times (in one of them I “hunted”, and destro ...Show All
GaryMcC OOP Data Access Question
I am trying to grasp and understand OOP better and I have a question in regards to d classes that perfrom CRUD operations. I am looking for input and thoughts on seperating CRUD functions from domain classes. My application has three domain classes: item , cart (which contain items) and user (manage the carts, add remove items and such). Items and carts both expose public methods that require CRUD operations and I do not want to build the CRUD into the class so I have added a data class for handling the CRUD operations. My qeustion is should each item (could be 1000s) and cart (100s) object create a new instance of the data class for calling the methods for performing needed CRUD functions This just seems to be alot of overhead by cr ...Show All
srividyaramesha How do I rename the administrator on a given machine via c#(System.Management?)
I've found a few bread crumbs, but i have not as of yet figured this out.. here's what i know. You're supposed to be able to do it using WMI via win32_useraccount.Rename, You can call WMI stuff in c# via System.Management. What I need is how to tie those two pieces of information togther to allow me to make the changes. Can anyone help Give me a few more breadcrumbs to follow Thanks, Eric- Thanks! That worked perfectly! Eric- Can you suggest a different mechnaism by which the same thing can be achieved programatically, or is it impossible to do in Win 2k Thanks, Eric- & ...Show All
Eric Bickle - BlueRealm Beginning C# / .NET Questions ( Timers, Strings, and HTTP servers)
I've been a Delphi developer for several years but am trying to learn .NET and C# but I have a few questions... 1) Does C# / .NET have timers I'd like to setup a timer so that a function is called every XX minutes. 2) How can I split a string containing linebreaks into an array (or any other object) For example let's say I have "Hello<CR>To the world!<CR>" then I'd like a[0] = "Hello" and a[1] = "To the world!" 3) Does C# / .NET have any simple built-in HTTP servers I'd like my application to have a built-in webserver for remote configuration (sort of like a router configuration web server) Thanks for any help! For your first question Yes .Net ha ...Show All
MatthewVincent Exception has been thrown by the target of an invocation?
hi, What do these errors mean Method 'GetDataAdapter' in type 'Business.SimpleDataAdapter' from assembly 'Business.DataAdapters, Version=1.0.0000.00005, Culture=neutral, PublicKeyToken=12fgdfg12fgeg2gfdg' does not have an implementation. Warning 1 Exception has been thrown by the target of an invocation. 0 0 why do they stop the UI designer from displaying the form Thanks. The error message actually is pretty clear: " does not have an implementation ". The baseform has to be painted in order to display your form, and apparently you have added an empty constructor. This will be called when the designer tries to draw the form and makes it break. By the way, is it void, or di ...Show All
Jneve7 Icon Transparency
I'm having trouble saving a transparent icon. The icon is stored as a bitmap until I save it so that I can use the setPixel method. This code should give you a basic idea of the problem: Bitmap img = new Bitmap (16, 16); img.MakeTransparent(); //Make all pixels transparent for ( int x = 0; x < 16; x++) for ( int y = 0; y < 16; y++) img.SetPixel(x, y, Color .Transparent); //First save option img.Save( "C:\\iconBmp.ico" , ImageFormat .Icon); //Second save option Icon icon = Icon .FromHandle(img.GetHicon()); FileStream stream = new FileStream ( "C:\\iconIco.ico" , FileMode .Create); icon.Save(stream); stream.Close(); When I use the first option ...Show All
Tricos Problems with error CS0118!!!What to do???
Hello.I wan't to create a animation in DirectX so I went to this site http://www.riemers.net/Tutorials/DirectX/Csharp/tut2.php to learn.But I receive error CS0118!!!Why Here are te content of the files: Program.cs: using System; using System.Collections.Generic; using System.Windows.Forms; namespace The_City { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { using (TheCityEngine EngineConnection = TheCityEngine()) { EngineConnection.InitializeDevice(); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new TheC ...Show All
Seradex Combobox.HandleCreated question.
I decided to fill a combobox with items from a DataSet but it naturally should work only once. I chose HandleCreated method. The odd thing is: the ComboBox is filled up TWICE: I see a double set of my record fields in the control. Is it something specific to this method that it fires twice I checked my entire code and could not find another place where this function could be possibly called from. What is a better way to do this task Thanks. There are better places to fill a combox box other than HandleCreated event. This event can be fired many times. Since the combo box will be placed on a form (or a UserControl perhaps) then you can fill it in the form's constructor or in the form's Load event. ...Show All
bgrva How do I create and use C# DLLs?
Hello all, I am trying to create my first C# DLL and I am having some difficulty. This DLL will house some common authentication functions. I will need to use the DLL functions on the front of many different C#.NET web applications. I do understand the basic concept of DLLs and thought I could just jump in and create one. So I created my DLL, added my functions, and referenced the DLL in a test web page. But when I tried to access the functions in the test app there were no functions available in the namespace. So I clearly did not create the DLL correctly. I am looking for a tutorial or a step-by-step example that I can follow. Thank you in advance for any help/references you can supply, Chris ...Show All
Pete Ford App.config in a C# Class Library
App.config in a C# Class Library I have a class library that has the following App.config file in it. ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- Problem is, that when I attempt to get the eventLogName key value my class object like this: ------------------------------------------------------------------------------- ConfigurationSettings.AppSettings["eventLogName"].ToString() ------------------------------------------------------------------------------- It doesn't see the appSettings as having any keys at all. I see the connectionStrings key, just not the appSettings key weird.... ...Show All
mitasid Code to have a button "Paste" text into a Rich Text Box...
I have a question... I am writing a HTML Editor and I was wondering if someone could tell me the code that I would enter in a button's event handler to be able to make that button "Paste" a certain code into "richTextbox1" I pretty much am looking for the button named "Form Open" to actually add the "<FORM>" tag in the Rich Text Box. I also got another question. Its similare to the above, only instead of involving a button, it involves a "Tree View". I want to be able to click down in a "Tree View" and find a certain tag like "<HTML>", and uppon double clicking on that "Tree View" button named "<HTML>" it will paste the "< ...Show All
tomc1 Parallel Port
Hi, I need to send to all data pins in the parallel port 255 bytes(make all pins enabled), how can I do this Thanks Thanks... That apparently solve the problem... excellent, glad I could help, or rather, the resource! check this out and see if it helps you at all: http://www.codeproject.com/csharp/csppleds.asp most likely you will need some drivers/API's to access parallel port since the SerialPort classes will of course not work I believe ...Show All
