Answer Questions
Kamii47 Why can't an interface method be internal?
When I try to make a method in an interface internal I get a compile error. Why is this Thanks in advance, Per Rasmussen. Charles: I see what you mean but then there isn't really much good in using an interface. Peter: One of the main points in an interface is that you can make a class implement several. Since C# doesn't have multiple inheritens I can't do the same with classes. About making the entire class internal. I have thought about this but my problem is that I would like some of the functions to be public and some to be internal (and some to be private and protected) and some of the functions I want internal should implement an interface. I can see what you mean conc ...Show All
Muhsin Zahid Uğur Get window handle
Hi All, Is there any possibility of getting the handles of all windows which are present in the taskbar. I need to track down which window is being closed and display a message stating the file name of the closed window. Ahh you must be using .NET 1.1. That example uses Generics which was introduced with v2.0. It enables you to strongly type a List. Easily solved for 1.1 by using an ArrayList instead. Process [] processes = Process .GetProcesses(); ArrayList windowHandles = new ArrayList (); foreach ( Process process in processes) { if (process.MainWindowTitle != string .Empty) { windowHandles.Add(process.Handle); } } Doing it this way you must cast the items in ...Show All
QWERTYtech [var++] or [++var] for [for] loop
I just recently noticed that for [for] loop in every single code I wrote and from code snippet in VC#, both use the same following code pattern (notice the increment pattern): for ( int i = 0; i < length; i++ ) { } AFAIK, the increment condition I should be the next value which is [i = i + 1]. And I think [i = i + 1] is better translated as [++i] rather than [i++], though both of them behave indifferently in the looping process. What do you think about this, guys I think the same. But on the same topic, what's the difference from the efficiency point of view between for (i=0; i<max; i++) makeSomething(); and for (i=0; i++<max;) makeSomething(); or even (if correct) for (i=0; i++<max; ...Show All
Michele_T application settings for class library
I'm running up against a deadline and I'm having some troubles with config files for a class library. While doing some work on a DLL I decided to convert our home-grown config file reader to use the new application settings abilities of VS2005. After doing the conversion and installing the assembly on a test server I noticed the the config file is being compiled into the DLL. Is there a way to tell the compiler not to do this If I have to recompile the whole app when one of these settings changes, I may as well hard-code them. Only admin will be changing things in the config files. Any help will be greatly appreciated!! I know this is a long shot, but I've got to ask anyway. Is t ...Show All
Jarrardi Unrecognized configuration section 'connectionStrings' on a Website
Hello, First I developed my project in Visual Studio 2003 and it is running on a website quite well but now I want to add a sub project in it I developed this in Visual Studio 2005 but it is not working at all, It is giving error "Unrecognized configuration section 'connectionStrings'" PLease guide me ASAP how can I fix that problem Remember I AM USING THIS ON INTERNET not on local machine or local IIS. Please Reply me also on abubakar.malik@gmail.com Regards, Abubakar Malik Netherlands 0031 64 2354713 I presume that your webapplication is using the 1.x engine... And you need to configure your subapplication to use the 2.x engine instead... You mean you want informat ...Show All
Lord Zoltan SP2 causing error?
I have a project that is having issues with SP2. It is a browser that was created to incorporate encryption and decryption protocols. I have done some minor fixes to the code since it was originally made, on my machine with SP2; now, the browser has exceptions on machines still running SP1 with the Explorer 6 browser object. In order to recompile this application to run on these older machines, do I need to remove SP2 from my own machine, or does anyone know of a workaround Thanks Again by looking at the code that is causing this issue, you still haven't told us what the code does. I mean for all I know you could be automation Word to print reports. But do you know that is causing this ...Show All
srathee hiding explorer bar
how can i hide explorer tile bar, menu bar, tab bar(everything behind my web page) after mypage opened; is it possible i cant use pop-up window because my reason is that i want to use my window like this;; i will open my webbased program in thinclient(with windows ce 5.0) automatically and thinclient use this page in 42 inc lcd hd screen so when thin clients open my page in screen explorer bar must not be there; because screens will be touchable so people should not see explorer bar is it possible with c# codes or how can i do this is anybody have an idea yes i mean like this how can this be with asp.net 2.0 page and additionaly if it is possible i dont need title bar and adress bar too; can you h ...Show All
krhoover Security error while trying to run C# application
Hi I have a C# windows application which I run by giving the arguments to local files eg:- HelloWorld c:\testdata\hello\ c:\testdata\sign\ It gives me an error The given path's format is not supported. at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath) at System.Security.Util.StringExpressionSet.AddExpressions(String[] str, Boolean checkForDuplicates, Boolean needFullPath) at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList) at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Bool ...Show All
globbe One cell's data out of a TableAdapter
Easy Don't know... Assuming a given TableAdapter (or even a DataSet or DataTable), how can a drill to one specific cell and get it's value I tried on got a lot of stuff like "Caption" or "DataType" doing this: Data.Tables[0].Columns[0]. But how can I get the actual DATA, the value if this cell Thanks, Finch. Well, pretty much. Here what I was looking for: MyTableAdapter TA = new MyTableAdapter (); DataTable DT = TA.GetDataByID(id); DataRow DR = DT.Rows[0]; MyTextBox.Text = DR[ColumnID].ToString(); Thanks, Mark. try: Data.Tables[0].Rows[ Index ][" columnName "].ToString(); does this help ...Show All
Simon Dahlbacka Regain/EndRegain
Sometimes I see some coeds that starts with #regain with some other codes in it and ends with #endregain... what is this for and what does it mean I have a c# book its there.. but cant find were it explains it. Also what good is it for Ahh I see so then I guess I dont need to learn that, correct because.. Im writing things via a programmers editor :) thanx.. although Its still good to know. Note also, that #region/#endregion is actually only used by your text editor, and most don't recognize it. THe tags were created by Microsoft for VIsualStudio, and some other text editor for programmers have started to as well (I believe #developer does), but more general purpose text editors (like notepad) never will. thats right. i ...Show All
sczzmxzx Object reference confusion.
I have a simple function located in Class2.cs - an auxiliary file for Form1.cs (Console Application in VS2005). It take one parameter: string. This string is supposed to serve as a switch for selecting the right string to build. public string getConnStrings ( ref string switched ) In the calling function I call the function in question as: string switched = "1"; string str1 = Class2.getConnStrings (switched); // or (ref switched); I get this error: Error 1 An object reference is required for the nonstatic field, method, or property 'tapTCPports_1.Class2.getConnStrings(ref string)' D:\VCsharp_Projects\tapTCPports_1\Form1.cs 1231 21 tapTCPports_1 When I placed the function getConnStrings into the ...Show All
Cameron D Best Practice: Ref Object
Hi Gurus: I'm trying to create a generic Create and Destroy methods that basically create and destroy objects of various classes. In the below code example, I'm creating and destroying an object of ErrorMessage class. It works! public static void Destroy( ref ErrorMessage obj) { if (obj != null ) { obj.Close(); obj.Dispose(); obj = null ; } } public static void Create( ref ErrorMessage obj) { if (obj == null ) obj = new ErrorMessage (); } How do i make them generic, so that i can use 'em with other class objects. Thanks much in advace. A few issues with this. 1) I am concern ...Show All
Rathin Padia Help required to solve circular dependency problem in vb2005
I am working on an application design that requires two projects to cross reference each other. I found the excellent Formfactory / Interface example/solution (listed below) on this forum. Unfortunately I am not C# literate. I understand and appreciate the method, but my attempt to convert it into vb2005.net has been defeated by the C# syntax. I would greatly appreciate someone (multilingual) providing a translation into vb2005.net Here is the C# solution: The pattern to solve this is abstract class factory , together with the singleton pattern. What you have to do is the make a classfactory for the forms . This classfactory you can place in your main program, which anyway MUST reference your assemblies, thus it w ...Show All
weoili Error when addin icon to project
I created an project in vs2005 C#. when tring to add icon to project -->properties --> open, error ecure and the project close. what wrong do i need to wait for spk1 If you get an error when opening project properties it sounds like there's something badly wrong with your system. Don't wait for service pack 1 - find out what's wrong with your system! First of all, what's the error (Secondly, why on earth would you post a message to a forum saying that "error ecure" without telling us what error just occurred It's incredibly difficult to help when you leave out critical details like that!) Second, try repairing your VS installation. If you go to Visual Studio in yo ...Show All
Shokino How to get Custom BackColor on Data Grid View Control Row Headers and Column Headers in Visual Studio 2005 C# DotNet
Hi I am getting the problem in changing the Default Back Color of the Column header and the Row Header of the DataGridView Control in Visual Studio 2005 C# Dot Net. Can you please give the solution or the way around. Ajay Kumar Software Engineer Metacube Softwares Pvt.Ltd. Sitapura ,Jaipur. Per MSDN docs "RowHeadersDefaultCellStyle property Gets or sets default cell styles used by the control's row headers. Overridden by the current theme if visual styles are enabled". You may want to check into that. ...Show All
