Answer Questions
holly kilpatrick 22222 Overwriting code files
Is there a way to allow Visual Studio to automatically overwrite code files without asking me (the user) each time if the file is read only There is no easy way to accomplish this. You could however write an extension for Visual Studio that does this but personally I would not recommend that as source code controlled files also depend in the Read Only attribute and you do not want to mess with this. ...Show All
furjaw problem with update
Hi here i'm trying to update a row dynamically using c# ado.net like this _sqlDataAdapter.UpdateCommand = new SqlCommand ( "UPDATE employee SET emp_name = @emp_name" , _sqlConnection); _sqlDataAdapter.Update(_dataset, "employee" ); but it shows exception like this sql exception was un handled Must declare the scalar variable "@emp_name". how to solve it thanx in advice Nagu you need to add the parameter "@temp_name", giving it a value also, and adding it to the SqlCommand/parameter collection example: SqlParameter myParam = new SqlParameter("@emp_name", SqlDbType.NVarchar, 10); myParam.Value = "John Smith"; _sqlDataAdapter. ...Show All
huabing78 System.Diagnostic.Process.GetProcesses()
Hello, I have a quick question about the process array being returned from the GetProcesses(). Specifically, why does the process array contain an entry for explorer.exe but I can not get the title of any of any explorer windows open. For example, I have 3 explorer windows open each viewing a different directory. But, none of them show up when I bind my list of a grid control. So, do I need to ignore what I get from the GetProcesses() call and just enumerate all top-level windows that are visible Is there another technique that would allow me to continue to use the Process[] without having to resort to interop Thanks for your time/help! .jdt. AFAI ...Show All
Serdalis How to transfer color images to grey images using C#
Hi, I am trying to use C# 2.0 and visual studio 2005 to compile a window app or web app. In this app, I have to transfer almost 2,000 colorful images to grey images. I do not know how to do that Anyone can provide a block of simple example for that Thanks a lot. Better yet, since human eyes have different sensitivities to R,G,B light, the following matrix gives you are more "natural" transform float [][] matrix = { new float [] {0.299f, 0.299f, 0.299f, 0, 0}, new float [] {0.587f, 0.587f, 0.587f, 0, 0}, new float [] {0.114f, 0.114f, 0.114f, 0, 0}, new float [] {0, 0, 0, 1, 0}, new float [] {0, 0, 0, 0, 1} }; Thanks a lot for you guys' suggestions. Hi, FugersonHall ...Show All
Rick.H Conditional Property?
How can I make a class property available only if the class state meets certain criteria. For example, if I have a class "Dog" with properties "CroppedTail" and "TailLength". I only want "TailLength" property to be visible to the user if "CroppedTail" is false. Thanks, Hammy Or just throw an exception in the TailLength property if CroppedTail is false. I really wouldn't go down the route of having a base Dog class and a subclass for dogs with tails... Took me a while to get back to this thread. Thanks for the replies, I will probably go with the sub class. To me it seems that you want subclasses... (One for croppedta ...Show All
Thunder2002 Defining custom functions for code snippets
Code snippets allow you to use functions to do some processing on the data that gets inserted. AFAIK, currently there are only three functions available for C# (for instance SimpleTypeName). Would it be possible in any way to expand this set of functions For instance, I'm looking for a CamelCase function to be able to create a code sinppet that outputs code such as this: private int _myNumber; public int MyNumber { get { return _myNumber }; } Because of this naming convention, I only want to specify the type and name, and not as in the current propg code snippet, also specify the fieldname. Any ideas You can use macros inside of snippet literal elements... For instance as a simple property snippet... ass ...Show All
Vista2007new What is Reflection ?
This is not a coding question, but I want to know what exactly reflection is. If someone can give a code sample the way to do same thing with and without Reflection. Thanks, Harsimrat Hi I just do some coed with this part, as we can add controls by input its type name: for ( int i = 0; i < al.Count; i++) { string a= "System.Windows.Forms.Button" ; //this can be stored in XML file System.Reflection. Assembly ASS = Assembly .GetAssembly( typeof ( Form )); Ty ...Show All
FreddieCode Application design
Hello everyone! When you start a new application in C# do you create a WindowsApplication project, add your controls in the designer, double click them and enter what should happend in the eventhandler or how do you design your applications I've searched for simple tips on application design but all I find is advanced documents for enterprise solutions. I want simple tips like, use the Command pattern for all the actions in the application, etc. Thanks in advance! -Martin It depends on the level of your project and how extensive you want it to be as well as is this a project thats temporary and basically will be used for a few months by an end user and dumped, or is this a project that will be built on and updated What should a ...Show All
logtorahul shutting down remote computer using wmi
Hi, I need to be able to shutdown a remote machine using WMI. It sounds fairly starighforward, but nothing I have come across seems to work. any help out there Thanls. Hi, nimo These resources may helpful to you: http://www.csharpfriends.com/Forums/ShowPost.aspx PostID=36953 http://www.thescripts.com/forum/thread254652.html Hope you can get the answer. Thank you ...Show All
narasiman_jayachandran_2b5374 Struture within a Structure
Hi, I have the following two structures public struct structBaseFile { public string Filename; public string Language; public string Encoding; public string Path; public string Platform; public string Filetype; public structLocalFile [] Loc_File; } public struct structLocalFile { public string Filename; public string Language; public string Encoding; public string RelativePath; } As you can see structBaseFile contains an array of structLocalFile - my problem is...HOW do I initialise this. I have something like this currently structBaseFile _basefile = new structBaseFile (); _basefile.Filename = "file&q ...Show All
refaeldakar Error compiling auto-generated ActiveX control wrapper code
Hi, I have a third-party ActiveX control which I would like to use in a .NET environment using the typical COM interop mechanisms, i.e. just drag it from the toolbox onto a form causing Visual Studio 2005 to automatically create the required wrapper assemblies. This is the theory. Practically, when trying to do so, Visual Studio fails to create the .NET wrappers prompting the following message: Failed to import the ActiveX control. Please ensure it is properly registered. It succeeds in building the type library DLL ( MYCONTROLLib) , but brings up a compiler error when building the actual ActiveX wrapper ( Ax MYCONTROLLib) : Failed to create the wrapper assembly for type library "AxMYCONTROLLib". Compiler errors occurred w ...Show All
MA2005 Guide on Cross Threading
Anyone have a good guide on cross threading Essentially, I'm trying to access a Windows form control outside of the thread it was created in. Any help would be greatly appreciated. in what way I guess you would do the same thing if you want your main thread (UI) to call/create/show another form rather than from the other (non UI) thread. the code posted/link posted applies generally for anything you do cross threading, however the only thing that changes is just the parameters really and thats it. So instead of taking in a bool value, you can have an int value, or a string, or whatever. The delegate signature must match the method signature, as you can see Controls work fine, now how bout hidin ...Show All
customization help me to convert vb.net property to c# syntax
Public Class Class1 Dim strCasenumber As String Sub Class1() End Sub Dim h As New Hashtable Public Property Item( ByVal key As String ) As String Get Return strCasenumber End Get Set ( ByVal Value As String ) h.Add(key, Value) End Set End Property End Class C# has very limited support for indexed properties. You'll be stuck if you have more than one property in your VB.NET class. If not, you can use an indexer. The original VB code looked wrong, I'll make corrections as I thought necessary: public class class1 { //private String strCaseNumber; private System.Collections.Hashtable h = new ...Show All
tkroll Having only one process running
Basically, this is what I am trying to do: When a user runs the app, the first process is created, however, when a user then attempts to run the app again, rather then a new process be created, I want the the new process to recognoize that there is a process already running, and to tell the existing process to spawn a new window (form) and then die. At this point the existing process spawns a new window (form) and life goes on. I believe the basics of spawning the windows (forms) are through the use of Threads, and I have the basics of the forms being created correctly, and the and keeping the process alive through the life of the different threads, but, I can't figure out what I need to do to get the 2nd process to not run and instead use ...Show All
Scott Wickham Process.start() how to
Hi All, I'm using process.start() to execute msbuild.exe. Is there any properties or method that I could set or call to wait until it completely finished before the next line of code get executed Best Regards, next line of... your C# code there is. you need to use a WaitForExit() method in the Process class. Example: Process theProcess = new Process(); theProcess.StartInfo = new ProcessStartInfo("filename.ext"); theProcess.StartInfo.Arguments = "args here" theProcess.WaitForExit(); theProcess.Start(); this will wait until the process has finished executing before running the next line of code in your C# app Hi, I would like to redirect the process out ...Show All
