Ron Riggs's Q&A profile
Visual C# Variable scope ina foreach loop
Hi, I get a compiler error when I declare a variable of the same name as the one declared in a foreach loop as the code snippet below shows: foreach ( FileInfo file in sourceDir.GetFiles()) { ...} FileInfo file = testDir.GetFiles()[0]; The error is: "A local variable named 'file' cannot be declared in this scope because it would give a different meaning to 'file', which is already used in a 'child' scope to denote something else" I dont see why this is a problem if the two fiel variables are in different scopes or am I wrong in that assumption If not, then why do I alse get a compiler error if I try to reuse the variable by changing the second line to: file = testDir.GetFiles()[0]; Thanks ...Show All
Silverlight (formerly WPF/E) VisualBrush
Hi Is WPF/E XAML going to support much more then what is currently in the December CTP e.g. VisualBrushes for doing video relection etc or the Bitmap Effect classes etc Was just hoping to see how VisualBrushes performed in WPF/E with Video etc Think would be good to see the other standard WPF Panels and Controls next. Followed by Styles, Data Templating Then Bitmap Effects, Visual Brushes etc Acutally releasing bit by bit in with each CTP will be quite cool and not so overwhelming :). cheers ...Show All
Visual Studio Team System Managing permissions
Is there a way to restrict a user's ability to create, edit and delete labels or branches What I want to do is to have only certain users to have permission to manage labels and branches. Can this be done Sorry. Here's the correct link. restrict access to top level folders The basic idea is to deny access at the root level, then re-enable it on certain subdirectories. Since denies trump allows, you'll need to turn off inheritance for that to work. (You leave inheritance on for the children of the top-level folders, obviously). ...Show All
Visual Studio Error trying to run the vcbuild task
Hello, I have installed the Visual C# 2005 Express and created a c# project. I'm trying to create a build file that builds this project. I created a target which uses the VCBuild task with my project file (.csproj) as parameter. I get the following error: \build.xml(20,3): error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK,2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere. I guess I'm missing something, I tried to find the file "VCBuild.exe" and coudn't. Should I install the latest vesrion of the SDK or maybe I must have the visual studio 2005 and not the express ...Show All
.NET Development Bizarre .NET performance benchmarks
While attempting to achieve a maximum performance in .NET code I have stumbled on a very peculiar effect. If you compile and run the following C# code, you get a better performance in Debug configuration than in Release configuration. Moreover, if you comment out any one of the unused (!) case blocks in the Distance method, you get 5-fold !! increase in the performance in the Release configuration. I would appreciate any explanation that anyone can offer. And it would be great to hear comments from the .NET development them if they are following this forum. Thanks, Victor P.S. I am using VS 2005 and Framework v 2.0.50727.42 using System; using System.Text; using System.IO; using System.Diagnostics; names ...Show All
Architecture Dataset, Typed Dataset or NHibernate?
Not again.... I know some of the experts here will say. But I have read tons of articles, blogs, forums, and still can't decide on which to use to pass the data among the layers. Here is what my design need to take care of: 1. 3 layers architecture, where UI, BLL and DAL should be seperated. 2. The BLL/DAL should be somesort like "portable", can be reused in Windows Application and Web Application. So no repeated code needed. 3. The BLL/DAL can be called from within an application or through remoting/web service. 4. The BLL/DAL can act like APIs which can intergrate with other non-.Net system (VB6, VFP, C++, Java, etc.) I have to mention I have no experience in remoting, web service and COMIneterop (yet), but these will ...Show All
Microsoft ISV Community Center Forums the function about string "Right()"
The function about string "Right()" is not support by office 2000 and office 2002. May I know what can I do to Import the library Provide a code sample that is not working. Right() and Right$() have been part of VBA since Office 97 and probably Excel 95. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ ...Show All
.NET Development need help in updating records SQLException (.net1.1)
can anyone plz solve this probelm I'm getting this sqlexception at the point where I've written this in comments. I just dont understand. I'm giving this value in the parameters as u can see, its getting the rt value as well. plz help me out with this... thanks /* system.data.sqlclient.sqlException: procedure BillUpdateCommand expects parametre "@Original_BookNo" which was not * supplied. * bla bla blah *line 995 t CREATE PROCEDURE dbo.BankUpdateCommand ( @BankName varchar(50), @Original_BankID numeric, @Original_BankName varchar(50), @BankID numeric ) AS SET NOCOUNT OFF; UPDATE Bank SET BankName = @BankName WHERE (BankID = @Original_BankID) AND (BankName = @Original_BankName); SELECT BankID, BankName FROM B ...Show All
Visual C# Async Sockets
I have developed a packet relay kind of program its is like a proxy kind of stuff The main objective is It will listen to a specific Port async way and sends and recieves the data in async way. Once the client connects to that port it send the ip of the remote machine to connect to. This proxy/socket manager will relay the packets sent to and from the both the ends. For each client I am creating a async socket with BeginReceive and . EndReceive And there will be max of 10 -15 clients connects to this proxy. So thery will be 10-15 async sockets waiting for reading data or sending data. Is this the proper way of coding or we can achieve this in any other way Here why i dint use threads is becos i do ...Show All
SQL Server Some strange behavior with parallelism
Hi, In my package I have a source, a script component to make some changes to that and a destination. To speed up the process, within a data flow, I have created 6 copies of the above components and running them in parallel. Each source takes different set of data. I have divided the data using the record no such that, each set will read 1million records. Now, my question is, though each pipleline is supposed to process exactly 1million records, they are not running at the same speed. For example, 1 pipeline completes processing all 1million records whereas another pipeline processed only 250000 records in that time. I don't see any reason for why one should run slow while another is running fast considering that both are doing the s ...Show All
Visual Basic Collections and updating items...
Can you update items in a collection or do you have to delete and re-add to get a change into the item For instance... I have a custom class I'm writing using the GDI+ just as an exercise. And in that class I have a collection of a custom sprite structures. I'm attempting to access a sprite item in that collection and update x and y coordinates by using an intermediate object... But the values are just discarded after the object goes out of scope. dim t as new spritebase = col.item(key) t.x = 23 t.y = 50 do I have to do something more like dim t as new spritebase = col.item(key) col.item.remove(key) t.x = 23 t.y = 50 col.add t If this is the case, it seems like it would be really inefficient (and GDI+ isn't conducive to efficiency a ...Show All
.NET Development To regex - or not to regex?
Hi, I have yet another regex query - this time regarding the retieval of a URL from HTML. I have a string called HTML, with a number of links on it. The format for these links is something like: <a href="/index/welcome.php action=one&section=27">one</a> Now, I only want the link which is called one (in the link text - so between the > and the </a>), and from that link I want everything between the " marks. Can anyone help me do this Thanks From your posts Martin, I think you're overusing regex. I HATE regex, its so unnecessarily hard, when substring, and trimstart, and trimeend, could all work. Just trim the "a href and /a" and youre done. ...Show All
.NET Development Referencing Assemblies Through Code
How can I reference an assembly through my code, I don't think it can be part of a project, this is related to my previous thread about 3 days ago, but I prefer to keep different questions in different threads. Anyways, Upon running my game, it will build a .exe, from the contents of a .cfg file, I need the .exe that it outputs, to be able to reference my main Game, I need it to be able to change variables and stuff, they are mostly all set to public and what not... OH, okay, yeah I totally didn't think about that, I don't need an exe at all, thank you so much, I may still have a question as to how to do this though, the loading part. Edit: Okay, but , will both of them be able to access each other I ne ...Show All
Game Technologies: DirectX, XNA, XACT, etc. Cannot Display Graphics
When I tried the tutorial for 3D graphics, but whenever I run it, it tells me that "Both a valid vertex shader and pixel shader (or valid effect) must be set on the device before draw operations may be performed." Can anyone tell me what's going wrong Also, with the 2D graphics tutorial, when I run the program it tells me that the following method is "Invalid:" spritebatchA = new SpriteBatch(graphics.GraphicsDevice); Can anyone help me I'm very confused. I'm pretty sure this, for once, is not a hardware problem. Compare: Exception when no suitable graphics card is installed: Could not find a Direct3D device that has a Direct3D9-level driver and supports pixel shader 1.1 or greater . and Exception ...Show All
.NET Development Trouble catching exception
Hi, I am having this problem catching a exception in a try catch block as shown below try { DialogResult result; result = wizard.ShowDialog(); } catch (PackageCreationException e) { MessageBox.Show(e.Message, "Failed", MessageBoxButtons.OK, MessageBoxIcon.Warning); } now the wizard is a form which throws a PackageCreationException if it fails this works fine if it is run in the Visual Studio environment but when run as a standalone application this exception is not caught. I have been cracking my head over this. I can catch and handle exceptions fine every where else but here. Does anyone know why this happens ...Show All
