Answer Questions
SQLServer2050 I had one problem about modifying the content of the following file, featured by ":" and "\t".
Dear all: I had one problem about modifying the content of the following file. Can you help me a little The structure of target file is as follows. abc: 100 def: 888 ghi: a.log jkl: 0 mno: c:\123.txt Thinking about the effect made by "/t". the structure of file looks like follows. abc:\t100 def:\t888 ghi:\ta.log jkl:\t0 mno:\tc:\123.txt I wanna update the content followed by "jkl\t", 0 to 5555. Apparently, I have to split the file by both colon ":" and "\t" when using Streamreader. How shall I make it And is it possible for me to directly modify the value "0" which is after "jkl:\t" instead of reading the whole file firstly, th ...Show All
mwoodruff Degraded performance in DevStudio
About a week ago I began noticing a sharp decline in the execution speed of the Visual Studio 2006 at all levels. Even in the Editor Window when I make a change the cursor won't move until good 5 seconds later. I checked the CPU usage in the Task Manager and can see that even on small, insignificant cursor movements in the source code editor the usage is up to 13%. Anything more substantial brings it up to 100% in no time. It does not happen all the time but very often. I tried to figure out the cause of it. My app is getting larger but I do not think it is exceptional. The computer is very fast (3.8GHz CPU, Bus 800 Mhz and 2Gbytes memory). What could be the problem Thanks. The Studio has 6 projects. Only one of them is re ...Show All
dmatth 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
Jassim Rahma How to tell VS C# to stop coying ref assemblies locally
Hello, I'm using VS2005 Pro Edition and my C# project is referencing an external assembly. The external assembly gets copied locally in my project folder when I build the project in debug mode. Also, the output library that the project builds is created twice: one copy in the project output folder (as set in my project) and another copy in the obj\Debug folder. I really need to get rid of this behavior. Is there an option in VS2005 to avoid that Thanks for your help, -mab Open the "References" node in Solution Explorer, select the reference to the external assembly. In the Properties window, set Copy Local to False. OK I see: <Private>False</Private> What ab ...Show All
Ajay Pathak Best way to shutdown async socket
Hi I'm writing some network program and made something that look like server. The problem is that I can not shut it down. The code looks like this: CNetwork { void Start () { <socket creation, binding, etc.....> mSocket.BeginAccept(new AsyncCallback(AcceptConn),mSocket); <code continue.......> } void Stop () { if (mSocket.Connected) mSocket.Shutdown (SocketShutdown.Both); mSocket.Close(); mSocket = null; <code continue......> } <code continue......> } Error ocures when: CNetowrk.Start() and immideatly CNetowrk.Stop(). It seems like when I creating socket and immideatly starting with BeginAccept I c ...Show All
Eddie C Variables and Methods
I have passed two variables into a method, and it modifies them internally, and then assigns them. For example: public void MyMethod(String var1, String var2) { String methvar1 = "x"; String methvar2 = "y"; var1 = methvar1; var2 = methavr2; } When the method exits teh external variables (var1 and var2) are unchanged, even though in the method they have been reassigned. Normally I would just return the variable to avoid this problem, but how do I return two variables at once Arrays dont work as in my actual code they are each arrays. Any ideas Mike Thanks very much. The code now runs perfectly thank you. Mike Parameters are passed by value, for stri ...Show All
Benedikt Can I Ignore certain exceptions?
Hello, I am currently writing an application that scans a directory for its files and will copy certain files to a new location. I am successful at this operation until I get to a file that the application (which uses the currently logged in user security context) does not have access to. When the access denied exception is raised the application goes to my try-*catch* which for this error I want it to ignore. Can I do this and, if so how Thanks, Quilnux i agree, thank you. Thanks for your help. Quilnux You code probably use a loop in which you execute copying operation. Put that operation in try catch blok. It will loo ...Show All
mattdawg There is no row at position 447: Cannot fill in a DataTable
I have a DataTable which is filled with rows from a data stream. I Add a row each time a new complete set of field values becomes available. There are 6 fields in rows: three float, one int, one DateTime and one string (rather short, about 4 bytes). After I streamlined my code to eliminate massive losses of data now the process is working fast. All of a sudden I get an error message: There is no row at position 468. I put a Console.WriteLine statement in the routine which handles filling the rows (individually, one by one). Row 469 was created and then the message appeared. In fact when I repeat the runs it breaks down at slighly different rows at each run. Also I have a button which I press. It creates a socket, send a request ...Show All
Bond 007 Problem with QOSQueryFlow
When I use the qWAVE API QOSQueryFlow, a problem occurs. UINT64 rate; ULONG Size=sizeof(UINT64); bool b=QOSQueryFlow(QOSHandle, FlowId, QOSQueryOutgoingRate,//QOSQueryFlowRate, &Size, (PVOID) &rate, QOS_QUERYFLOW_FRESH, NULL); If I set parameters to query the bandwidth with QOSQueryFlowFundamentals, The function succeeds. However, when I wan't to query the flow rate, I always get failed with a return value of false. Then I use "GetLastError();", which returns 87 ERROR_INVALID_PARAMETER Thanks for any help... Short answer about *reservations* is no. Windows does not interact with network elements to reserve bandwidth specified when ...Show All
mr4100 accessing custom entity objects throughtout the project
Hi, When we define a ProductEntity class for example. If I want to use the class object myProduct in a form1 and form2 and access the properties from different forms. Let s say, first I load an mdi form mymdiForm, then I click a button that loads form1 and in form1 i click a button that loads form2 and so on.. My concern: 1- where do I instatiate myProduct object. In the mdi, or in form1 or in form2 knowing that myProduct properties are assigned from controls located in the form form2. Also I want to make sure that I can access those properties in the mdi and form1 forms and all the project Do I declare myProduct as public or friend or what Also how can I access the object myProduct and ...Show All
Joao Pinto Accessing a public item through an interface
Hi, Hopefully somone can point me in the right direction on this.. I have an application that has to be able to handle multiple file types, so im using an interface to access the created object. So i have class1 and class2 and they both implement my interface, at loadtime the app creates one of these objects depending on the format. Everything about this works fine, but each of these classes have an array of public items and my question is: Is it possible to access these public items through the interface eg: myObject.items[4] In case its not clear what im trying to do i made a sample app with the exact same structure: http://www.turnipfan.com/sample_code.rar Thanks for any help, -Dave ...Show All
Urip Efficient search
Hi, I have two tables that I create to display information in a DataGridView Control. Now I need to compare the fields of these two tables. It is somewhat like: void SomeFunction() { for (int i = 0; i < tableA.Rows.Count ; i++) { DataRow rowA = tableA.Rows[ i ] ; for (int j = 0; j < tableB.rows.count ; j++) { ...Show All
Santa616 Adding Web References at Run Time
I'm working on a program and need to be able to add web references at runtime and haven't been able to find anything that would let me do this. Basically this is the way the program will work: 1. Allow user to enter asmx URL. 2. During runtime process the web service so it is accessible. 3. For now lets just say I want to print out all of the methods available from the Web Service. I've found examples of the AddWebReference method using an Add-In but can't seem to find anything explaining how to use this from a c# program. Any ideas or thoughts would be helpful. - Chris What happens when you add a webreference in Visual Studio is completely different from what happens wh ...Show All
JPC16 Allocating memory throws exception when trieng to use native code dll
Hi, I need to use a native code dll in my application. I am working on .NET2 env, written in c#. When I try to use the Init method in the native dll, it throws the following exception: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." I know this method supposed to open a com port and allocate a block of memory. I wrote a .NET wrapper for this dll. The h. file of this native dll includes 2 structures: 1. typedef struct ALARMREC { int Flag; int AlarmType; int AlarmUnitNum; int AlarmUnitWing; int AlarmLocation; int AlarmDelayFlag; char AlarmTime[20]; }alarmRec; 2. ...Show All
hellomahesh Antivirus and Firewall?
Is there a way to determine if antivirus software and a firewall is installed on your computer Thanks, Is there a Windows Service for the Windows Firewall yes there is but it won't be displayed in the Services system. the firewall service can be configured via using the command line "netsh firewall" - of course specifying options however it is recommended not to "toy" with this for alot of reasons - simply because the user won't appreciate it and can leave your system open (Without a firewall) to hackers and what not. Since XP SP1 I think, the Windows firewall has been enabled by default as soon as you install it due to the amount of viruses just going through the wire crawling into your machine. ...Show All
