Answer Questions
JohnD74 Exclude element from foreach index (MenuStripItem) HELP!
Hello! I have a foreach loop. How can I exclude one of the elements from being indexed: I have a foreach loop setting a property for each of the items in a ToolStripMenuItem category, but one of the items is a ToolStripSeperator, and I would like to exclude it so the foreach loop would set the property for all of the items EXCEPT the toolstripseperator. How can I do that Matt Maybe not an exception then, but I bet there is a whole slew of underlying code that traverses through the type information tree recursively, looking for the type. Which is a lot slower than just calling a virtual function. I take your point about GetType not supporting derived classes though. ...Show All
S_Parikh C# versus COM
Is C# really just making calls to pre-existing COM C++ dlls via the .NET Runtime In the context of the language itself. For example, some third party software vendors give you a C# api or a Java api to their product, when really all that is happening, at least in the Java api, is JNI making calls to COM components. Is C# it's own language, or is it just another layer on top of COM, which happens to benefit from a CLR, aka .NET runtime. My take. .NET is a complete replacement to COM, but they share many traits in common. Its metadata support is like COM typelibs (but more powerful of course) to represent types. CLR also introduces a bytecode (called IL) used to encode the program itself. ...Show All
Michal Konecny Check if a remoting service is up and running
Hi, I need to implement some kind of watchdog which checks if a remote service is running (and,if it's not, supposing the server went down, starting it on another machine) but I'm still trying to figure the proper way of doing it. I was thinking about using .NET Remoting, but I'm not sure it's the right way. Does anyone have any suggestion Thanks in advance for your kind help ! You can configure or monitor the state of services using ServiceController class. ServiceController class has a machine name property. So you can monitor or manage remote services too. But the running application's (your application' i mean) Identity must have rights to do so, on remote machine. So you may have to ...Show All
slaprade how can I write an application in C# which will support touch screen ?
I want to develop a software in which user can interact with the buttons via a touch screen. About what topic I have to know When we write an application in C# does it support touch screen facility please help. I believe that all depends on the hardware device itself if it supports touchscreen or not. the C# application will act as normal as the touchscreen commands/functions will be sent automatically to the computer as if you were using a mouse for example thank you. ...Show All
Vishalbhambure Need help with enum and color assignment
Hi, I need help with some enum and color assignment. This is what I need to do. I have an enum like: public enum statusFlag { Unknown = 0, Easy = 1, Medium = 2, Hard = 4, ExtremlyHard = 8 } From xml: (not sure how this is repesented) Unknown = Black Easy = Green Medium = Yellow Hard = Orange ExtremelyHard = Red Now, I have a set of color for each of the different status flags. These colors are user definable. Possibly will reside in an xml file. I am wondering how am I doing to do this requirement in C# assuming the color matching color of each status flag will be coming from an xml file (probably, app.config file) So, depends on the status variable, I need to pass back the equivalent color. ie. Is is probably going to ...Show All
Jamie Thomson C#.net How do you give a Windows service specific permissions?
Hi, I want to be able to create a new user account with only the necessary privileges etc (getting a web webrequest from a web page, then writeing the result to a file). And configure the service to run under the new user account. I cant seem to work out how to do this. Hope someone can help me. Thanks in advance kered Excuse my poor understanding, Can you put an example to show what you want Thanks If you wanted to know how to set user rights on a service then frederikm has answered it. OR kered pople wrote: I want to be able to create a new user account with only the necessary privileges etc (getting a web webrequest from a web page, then writeing the result to a fil ...Show All
Mitch Walker - MSFT How to hide code of .NET dll [aspnet + c#]
Hello, I have found few days ago that .NET dll can be reversed to view all source code. I have used Dotfuscator but it only renames variables etc. I want to hide code. Please reply with some concrete solution. thanks in advance with regards, Hi The DoFuscator also change the Methods name and class name and also make changes to the code, so it can also be reversed but hard to read and understand. So currently we have only technology to hide the code is DotFuscating, you can also purchase a professional version of Dotfuscator which have more options then the avalible free version with Dot NET Hi, Is there any other way by which one can hide code .... I also heard about some private/public key mechanis ...Show All
Will Merydith BackgroundWorker
Hi I have read the backgroundworker overview and usage on msdn and would like to implement on my project. Initially i put the component on a form of my appplication and it hits the error relates to cross-threading....from UI controls. Thus I decide to zoom in to the method that isreally time-consuming and use the backgroundworker.., instead of just throwing a 'high level' method which is found on the form itself. However I found that the line of code that takes a long time ( which is the one retrieving data from the db) found inside the controller class. How do i plug in the backgroundworker component into the non-UI controller class I mean the examples given from msdn applies the component on the form and now i am dealing with a single cl ...Show All
Elham Sarikhani How to Enumerate StringBuilder object with null character as delimiter between strings
hi all, i have a StringBuilder object with unknown number of strings each string followed by a null character. i am getting the only first string by whatever the parsing technique i used because of null character. any suggetions thanks and regards ranadheer. It's the CLR marshaler that cuts the string at the first null character. If you change the type from StringBuilder to char[] you should get the entire buffer back. All, I have a similar situation. In my case it is a return value from a function that I am trying to run. The returned string is supposed to be a set of null-delimited string values finally finished off with an additional null. i.e. Value1<nul ...Show All
debraj dhar Adding hyperlink to Excel sheet
Hello, I am trying to convert some VB.NET code to C# that writes information to an Excel file. What i'm having trouble is that i'm trying to insert a hyperlink to an local file like i did before but i can't seem to get past this exception. Here is my old code. Dim xlCurrentSheet As Excel.Worksheet xlCurrentSheet.Range("A3").Offset(yDir - 1).Hyperlinks.Add(xlCurrentSheet.Range(" A3").Offse t(yDir - 1), OrdPath, , , TextBox1.Text) here is the new code i'm trying: oRange = (Excel.Range)currSheet.get_Range("A1", "A100"); string ordPath = @"C:\\IDTWest\\orders\\order" + orderInfo.orderNum.ToString() + ".doc"; Object txtToDis = "order " + orderInfo.ord ...Show All
invantix Can flash files be imported in Csharp with providing interaction between Csharp and Actionscript?
Hi Everybody, Can flash files be imported in Csharp with providing interaction between Csharp and Actionscript Can anyone help me with a true and applicable answer Regards, 22DoorsDown Have a look at WebORB , that can be a bridge between Flash and .NET. There is also a blog post containing some pointers: " Flash OCX control and Visual Studio 2005 issues " Hi I go hte answer from a long time. U can use the event FSCommand in flash object and by actionscript send messages to that object. 3doorsdown ...Show All
patiatwork Winzip utility in C# web application
Hi We need winzip component in order to have utility which can zip and unzip a file. Is there any corresponding microsoft utility for web applications Many thanks in advance. Hi, Following is the MS C# Built-in Zip/Unzip utils. Which uses System.IO.Compresson Libs. Hope this help. using System; using System.Collections.Generic; using System.Text; using System.IO; using System.IO.Compression; using System.Windows.Forms; namespace Zipper { class ZipUtil { public void CompressFile ( string sourceFile, string destinationFile ) { // make sure the source file is there if ( File .Exists ( source ...Show All
ray_newbie_SSIS Why don't we use header file and Main in class
Hi 1-)In c# why don't we need header files What does c++ miss.So it needs header file but c# not. 2-)In c++ main() is not in a class.Main() is called by OS.It is a special function.But in C# it is also in a class.For example: class Exercise { static void Main() { Console.WriteLine(); } } Here this is confusing thing.Why do C# designers force us to put main in a class Does OS instantinate Example class for calling main().If not what is the magic behind this rule Thanks. ok my first questions answer is metadata.Thanks carlop. But for main() question i think maybe there can be some different purpose. OK Maybe i must ask so: Also is main() must be in a class for a language that want to be truely oo ...Show All
Roland J Young Oledb, number of rows... how?
Hi ! I did this command in oledb: "SELECT * FROM `test_table`;" How can i see the number of rows Thanks Hi, Visit http://www.thescripts.com/forum/thread294042.html this will solve your question Sorry, I am using: OleDbDataReader and OleDbCommand... Hello, You have not specified here if you are using dataset or datareader.... Here I am giving you example with dataset and dataview DataSet ds = new DataSet(); OleDbDataAdapter da; DataView dv; string row; //open connection here da = new OleDbDataAdapter(" SELECT * FROM test_table" , connectionstring); da.Fill(ds); dv = ds.Tables[0].DefaultView; row= ...Show All
_Stoic Exception Error Display
This snippet works well: catch( SqlException e) { for(int i=0;i<e.Errors.Count;i++) { errInfo+="Error Sequential Number:" +i+ "\n" + "Error Info:" +e.Errors .Message+ "\n" + "Error Source:" +e.Errors .Source+ "\n" + "Program:" +e.Errors .Procedure; } But the following snippet resulted in a compilation error: error CS0117:'System.Exception' does not contain a definition for 'Error' catch( System.Exception e) { for(int i=0;i<e.Errors.Count;i++) { errInfo+="Error Sequential Number:" +i+ ...Show All
