Answer Questions
sjb31988 string
i have a string called str and a char array called dizi. i have an if statement.if the string hasn't one of array members the if statement must be run.but it isnt working of course.where's my mistake :( if (!str[j].ToString().IndexOfAny(dizi)) { gecici = str[j] + gecici; index[l] = j; l++; } if (!str[j].ToString().IndexOfAny(dizi)) // Won't compile because IndexOfAny() returns an int, specifying the index of character found in the string and returns -1 if none of char is found else it returns the found index... So your code willl be: if (!str[j].ToString().IndexOfAny(dizi) != -1) // It will compile fine Best Regards, Rizwan To check if a string has any of t ...Show All
kyle4832 Hook and unhook and event using delegate
Q1. Is it possible to check if an event is being hooked for eg. cbxXXX.selectedvaluechanged += delegate { .....;} Any way to check the above event is being hooked Q2. How is it possible to unhook the above event once hooked i tried -= but it doesnt work correctly. Thanks Regards Alu well in that case this means i have to be careful when the application load initially and make sure it wont move into the events ...right :) maybe a focused check may help Thanks!. Regards Alu thanks it works well!...say ..is it ok every time before i hook an event, i perform a unhook first be it if it previous been hooked or not like cbxXXX.SelectedValueChanged -= cbxXXX_SelectedValueChanged; and immediately ... ...Show All
Keith Brown C#.net or C# 2005
Hello everyone, I have some intermediate knowledge on C programming and wish to learn C#. Searching through the bookshop, found there are two difference thing: C#.net or C# 2005. What is the difference between these two And in term of syntax level, is there any difference There is only one language with name C# which is usually refered to as Visual C#, C#.Net etc. C# 2005 is nothing more than a new version its also called C# 2.0 there are lots of new features and enhancements in this version. So if you want to start your learning process Get a C# book which targets latest version and Platform i.e .Net 2.0 and Development Environment for building C# 2.0 based application is Visual Studio 2005. Be ...Show All
Lamon Understanding fonts and how they work
Hi All, I've taken it upon myself to code a Xerox font viewer, I wish to do it using C#. But really need a bit of an insight into how fonts work and how they get displayed to screen correctly etc. Xerox fonts are unlikely to currently have a compatible viewer, but i'm pretty sure they must use some of the same principles as other fonts. Umm perhaps this is a bit vague but hopefully someone can help me Cheers, Paul There are two types of fonts: Bitmap - These are basically a black-and-white image of each character. These are easy to work with, but cannot be used with ClearType on Windows and don't look all that great on paper. Outline - These use vector outlines to create characters. Eac ...Show All
Brian Kramer Needing to understand dll imports...
Hi, <code snippet> using System; using System.Data; using System.Collections; using Microsoft.SqlServer.Management.Common; using Microsoft.SqlServer.Management.Smo; class Program { static void Main(string[] args) { BackupDeviceItem bdi = new BackupDeviceItem("AdventureWorks.bak", DeviceType.File); Backup bu = new Backup( ); bu.Database = "AdventureWorks"; bu.Devices.Add(bdi); bu.Initialize = true; // add percent complete and complete event handlers bu.PercentComplete += new PercentCompleteEventHandler(Backup_PercentComplete); bu.Complete +=new ServerMessageEventHandler(Backup_Complete); Server server = ne ...Show All
PatrikB. How do you convert int[,] into object[,]?
I've got 3 questions. Need help please, 1. I have a multidimension integer[5,3] that needed to be converted into object[5,3]. Is there any best way of doing it 2. What is the best/common practice of searching a record (to see if it existed) a) using executescalar() and what is the object that it returns b) any other suggestion 3. What is a safearray for Can anybody give me a simple example to demonstrate how to use safearray and its benefit Thanks in advance! no no no. Cast the thing. 1: How about the most obvious solution int[,] ints = ... object[,] objs = new object[5,3]; for (int i = 0: i < 5; i++) for (int j = 0; j ...Show All
SUMEET_1876 Visual Studio 2005 - PILE OF ***!
Hi, Although .NET 2.0 has brought ,any great additions to the .NET family, the IDE for me is the worst part of the experience. 1. The IDE is terribly slow... much slower than it should be. 2. The IDE seems full of bugs. These two problems do not make a good productivity combination. I do not believe Visual Studio 2005 is suitable for enterprise development, where you typically work on large scale solutions consisting of hundreds of projects. The IDE simply chokes on large solutions. Intellisense comes to a grinding halt and solution level configuration changes, such as setting debug/release mode take minutes (2minutes or more per click). The number of crashes of the IDE per day is also pretty high. We have started recordi ...Show All
sofakng class inheritance
hi, i am not sure where to post this, so i will post it here and wait to be directed. i have a problem with inheritance which leads me to believe that i am doing something fundamentally wrong. i have 2 classes: public class division { public string divisionName; } public class team { public string teamName; public division division; } these 2 classes are base. if i inherit both classes: public class superDivision : division {} public class superTeam : team{} i face the problem that superTeam.division returns me a base.division object. doesn't seem too bad, but the problem comes when i store a list of teams in the base.division. these teams are the base.team. so when i access them through ...Show All
Son_seph14 How to Check for Serialport status...?
Hi... How i can check Serailport status... Means whether another application is using that serialport or not... In my application, if i dont check this & if some other application or hyprterminal is using same comport then my application is crashing... Thanks in adavnce, Vinay As far I know this is only possible by catching the exception thrown when trying to open a port. You can create numerous instances of the same serial port across various applications, but only open one at a time. If this happens an InvalidOperationException will be thrown i.e. SerialPort port = new SerialPort(mPortName, mBaudRate, mParity, mDataBits, mStopBits); try { port.open(); } catch(InvalidOperation ...Show All
DeadlyEvilRyu Remove picture Box Controls
Hi all I have windows form, where in picture boxes are dynamically being created, I need to Remove all picture boxes from the form every time user clicks on the button to load new images , how can i acheive this. i tried with the following code , but it didn't worked PictureBox pic; foreach ( Control ctr in frmScreenShot.ActiveForm.Controls) { if (typeof(PictureBox)== ctr.GetType()) { ctr.Dispse(); } i also tried with this code snippet PictureBox pc; if (this.Controls.Contains(System.Windows.Forms.PictureBox )) { this.Controls.Remove(pc) ; } Welcome Each suggestion Thanks Hi, try the following piece of code: foreach ( Cont ...Show All
erzfezsf Calling Virtual Methods from Within Constructors
[Reposted from .NET forum] I have an issue and I wonder if anyone has run into this. As I know, you cannot call virtual methods from within constructors safely, because the inherited class is not constructed at the time of base constructor invocation. However, I am creating a base class whose internal workings are sufficiently complex that I had to create a series of virtual functions that the inheritors can modify. These are called when a particular property is set in order to set up the connective tissue underneath. This is not a problem. The problem exists because I cannot use these same virtual calls on either deserialization constructors or in the default constructor to perform these same operations when the class is first in ...Show All
DannoCoy Generic generics ... can Generic methods be constrained to accept generic types?
I can't find an answer to this anywhere and all my code hacks fail to compile. The shoprt story is like this. I can write a generic method that looks loosely like (off the top of my head): private T First<T>(T a, T b) { return a; } (sure this is a meaningless example but hey, I'm exploriung a point not an application). Now let's say I want to constrain the type T, this is fine (and a much cited example of sorts): private T First<T>(T a, T b) where T : IComparable { return a; } Now the fun begins. I want to constrain T to a generic interface not a specific one. Try this: private T First<T>(T a, T b) where T : IComparable <T2> { return a; } and whammo, compile time error: Error 1&nbs ...Show All
Mike_Brazil The "Target" property is reserved, and cannot be modified.
Can anyone explain this error message. It first appeared when attempting to build a project from a command line. It now appears anytime I attempt to create a new C# Windows application. Without example code that causes the error, it's doubtfull anyone will be able to provide much guidance. Peter, Thank you for taking the time to actually read my question. As I said, simply creating a new project causes the error. It turns out that we had an environment variable named "Target" in the system. Removing that cleared up the problem. Frank Interesting. That's something I wouldn't have expected... A more useful message would be nic ...Show All
Ravie14 Where are the messages going to?
hi everybody I've already successfully implemented a globally low level keyboard and mouse hook and it seems that this is all .net managed code could provide in global hooking. But after I got the message by the hook, where is this keyboard or mouse message going to the parameters and structures of hook event don't contain that information. any idea thanks in advance marffin wrote: It could be going to more than one applications It could be going to a particular application, as well as Windows and any other applications in the hook chain. The application with the active window is the likely destination of the message. It could be going to more than one applications I'm writing program to redirect keys a ...Show All
Samuel I new to programming..just need info
I am currently new to programming, but i wanted to ask a question about c#. What languages should I know before i try to understand or write code up to you really, it does help to have some experience in programming. if you know VB/VB.NET then converting to C# shouldnt be that difficult. I would suggest reading up some material and finding difference in terms of code between VB.NET and C#. you dont need to know any other languages to learn C# really, you can dig right in ...Show All
