624 Posted Topics
Re: Unless this code is running multithreaded, if the player is firing in automatic mode the code will be completely blocked forever, since the bool argument will not change once inside the while loop. If it is multithreaded, this class instance will lock up in automatic mode, eventually throwing an overflow … | |
Re: Your code is really confusing. But I suspect that your error is caused by setting a string to an number or vice versa. Determine the data types of all those fields (maybe give them more meaningful names too). Compare these types to what you are providing them - in this … | |
Re: In the first snippet it seems like you are setting the .Tag member of the entire datagrid, not the individual cells/rows. In the second snippet you are accessing the first index of the selected cells, then trying to get the tag member out of it's parent gridview. I would try … | |
Re: Neat little snipet. 1 Thing though. The max speed of a winforms timer tick event is actually about 20-30ms, so setting it to 1ms is actually just taxing your cpu a bit more than is necessary. | |
Re: I was hoping to see an actual compression algorithm, not an implementation of one you didn't write... | |
Re: Look into the System.Threading.Thread class and the System.Threading namespace to run code in parallel. .Net 3.5 and up also have something called a TaskFactory, which handles a lot of the overhead and complications that can arise when making multithreaded apps. I typically do all the threading myself, but my cooworkers … | |
Re: If it's an old DLL (pre .Net) you need to use regasm "path to dll" /codebase /tlb:YourTLBFileName.tlb. This will register it for a COM interop. I think the default place that programs look for dlls (unregistered ones) is in Windows\System32. If you really want, try just copying the DLLs there. | |
Re: You have a closing bracket on line 31 that should be an opening bracket { . Also, you will need a closing bracket on line 53 and 71. | |
Re: Why would the birth ever be nullable? Once the object is initialized, is this not its birth time? | |
Re: Here's something I wrote a while back to do just this with some data aquisition dll. The reason I had to load/unload it dynamically is because the driver was broken, and would keep the same device handle after the device was unplugged. When you plugged it back in, the handle … | |
Re: Just to keep you from getting excited, I don't have your answer. But really, that's a good thing. I don't think it would be a good idea to post on a publicly viewable, high traffic website like this a way in which a person can hack the windows OS in … | |
Re: Well if you keep track of all the shapes drawn, and use something that can be converted into a region (like a GraphicsPath) then you can use [code] Graphics g = myForm.CreateGraphics; g.FillRegion(myBrush, new Region(myGraphicsPath); [/code] But chances are you wont be keeping track of every object. To work directly … | |
Re: Without using Linq, this should work: [code] List<string> outputStrings = new List<string>(); using (StreamReader sr = new StreamReader(filepath)) { //file 1, read everything while (!sr.EndOfStream) outputStrings.Add(sr.ReadLine()); sr.Close(); } using (StreamReader sr = new StreamReader(filepath2)) { while (!sr.EndOfStream) { //file2, read a temp string in, if the outputstrings doesn't contain it, … | |
Re: Easiest way I can think of would be to crank the contrast up internally, then go by color on this high contrast image to look for edges (of a ball, in this case). For just a rectangle this can be a relatively fast calculation: -Find the leftmost pixel of color … | |
Re: Are you trying to access a memory address that is outside of the scope of your application and any loaded dlls? | |
Re: [URL="http://msdn.microsoft.com/en-us/library/system.char.isnumber.aspx"]Char.Number[/URL] and various other [URL="http://msdn.microsoft.com/en-us/library/424s1h3z.aspx"]Char static members[/URL] might be worth looking into. Also, if you want to get deeper into string parsing, look into [URL="http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.aspx"]regular expressions[/URL]. A few [URL="http://msdn.microsoft.com/en-us/library/system.double.tryparse.aspx"]double.tryparse[/URL]()'s would do the trick here too. | |
Re: [QUOTE=thines01;1737144]Take the calculateValues method OUT of the Readinput method. You have them nested together and that will give you an error. Also: 1) Change your "finalprice" to a double. 2) Add a constructor[/QUOTE] What's wrong with using a decimal here? They are much more accurate within a reasonable financial range … | |
Re: Datagridview's have an event that you can handle that will let you know if the databinding is complete. Something like .DatabindingComplete. If you handle this, have it set a boolean flag to true when you know the control is done with the databinding. This will let you know that the … | |
Re: Why would you want a client and server to run on the same machine (other than for development purposes, of course)? | |
Re: Start with a winforms hello world app and take it from there. What other languages are you comfortable with? | |
Re: Are the numbers entered on the same line? If so, what are you delimiting the numbers with? If it's on 2 seperate lines of entry: [code] double myNumber = 0; if (double.TryParse(myString, out myNumber) == true) { //The cast worked, myNumber now contains a double parsed from the string } … | |
Re: I think windows 7 starter only comes bundled with .Net Client Profile 3. You may be referencing a different framework - probably the full blown framework (3.5 or 4). When you run the program, does it appear in the process tab of task manager? | |
Re: You could use the .Tag property of each button to give it a coordinate. Then subscribe all the buttons' events to one event, and use this coordinate to identify the button. in drawchessboard: [code=csharp] b[i,j].Tag = new Point(i, j); [/code] [code=csharp] private void abc(object sender, EventArgs e) { Point ButtonCoordinate … | |
Re: That seems like a very CPU expensive loop to poll for mouse clicks. It has to go through hundreds (maybe even thousands) of enums, poll the GetAsyncKeyState, filter the results, then set flags. An event would have a LOT less overhead. As for why it's not working - I have … | |
Re: This depends. Are you familiar with other languages and interfaces (win32, sockets, multithreaded apps, etc). If you are, then it will just be a matter of syntax and which classes to use. If not, you will spend a lot of time banging your head on your keyboard like the rest … | |
Re: What library are you using? Are you familiar with graphics? (Coordinates, etc). Did the library you are using come with documentation? You've given us very little to work with lol. | |
Re: That would probably the smallest possible packet - though you should delimit each word with a special character that is not typeable (null perhaps). Then split the string based on this character with String.Split(). Another, more OOP friendly way but with much more overhead, would be to look into sending … | |
Re: As of now, there's only a small handful of commercial games that are written using the XNA framework. Not to discredit it - it is a pretty good interface in my opinion. The problem is, however, due to the lack of commercial use I fear it might not be around … | |
Re: You need to get the redistributable assemblies that correspond to your devexpress components. Then bundle these with your installer (if you have one made) and if not you will have to manually install and register them. | |
Re: In properties, you can set get/set to a specific accessor (private, internal, protected, public,readonly, etc) So, [code] private set{ this.label1.ForeColor = value; this.label2.ForeColor = value; this.label3.ForeColor = value; } [/code] Will probably do the trick. As for resizing, you can use the SizeChanged event to trigger a method that dynamically … | |
Re: I heard that they are only releasing a 32-bit dev preview, and the 64-bit one comes with no development tools. | |
Re: In the SQL query, you can assign aliases to column names. This is probably the easiest method. I totally forget how to do this, but I'm sure google can help you out with it. | |
Re: This would work - but there's a few other ways to skin this cat. A line with the start and end points being the same would draw a single pixel. A elipse with size 0 would also draw a pixel. Same with a rectangle. If you draw your function with … | |
Re: A delegate is the .Net equivalent of a function pointer. Basically it describes a function/method to be called (return type, parameters count, and parameter types) without actually being a function - sort of a prototype of a function/method. These allow your code to be able to describe a function without … | |
Re: You need to capture the MouseDown and MouseUp event, set a boolean, and remember the original coordinates: [code] bool MouseIsDragging = false; point Start = new point(); private void MyForm_MouseDown(object sender, MouseEventArgs e) { MouseIsDragging = true; Start.X = e.X; Start.Y = e.Y; } private void MyForm_MouseUp(object sender, MouseEventArgs e) … | |
Re: Looks like you should read into inheritance and polymorphism. Are you familiar with these concepts? | |
Re: I don't understand why people post solutions that they just googled themselves, when it would be just as easy for the OP to do the same.... | |
Re: [QUOTE=Tellalca;1726268]Delegates are not very powerful indeed. As you said, it is a master method that calls other methods when a specific condition happens. What it brings to the table is it has a subscription list. So if you do not know which functions to call while you are writing this … | |
Re: Yikes. Not only is that really hard to look at due to missing code tags, the code itself is terribly written! As for the printing problem - it seems more like a problem with printer configuration than with code. Try playing with your printer's page settings. | |
Re: I'm not sure it's possible to disable ctrl+alt+delete (not easily anyway). But you CAN disable task manager in user profiles (or just poll for taskman.exe and kill it). Also, killing explorer is an option as well - you can just relaunch it after the proper user entry. This way if … | |
Re: You have logic built into your 'Get' that tells it to increment every member variable by 1.... You must realize that the locals window uses this 'Get' when you try to get your values out of the class, therefore incrementing them each time you hover over it. You can fix … | |
Re: Ummm I am a bit confused by your code. But to make a list of classes: [code] class myClass { //Class implementation } //now to make a list of this class somewhere else... List<myClass> myClassList = new List<myClass>(); myClass myClassInstance = new myClass(/*ctor stuff*/); myClassList.Add(myClassInstance); //or, alternatively myClassList.Add(new myClass(/*CTOR stuff*/)); … | |
Re: [QUOTE=DevNet;1715649]Thanks for that one! :) Im gonna try it.. oh and by the way, I was wondering if after this is successfully compiled, is there a way wherein I could match/compare two images that have been clicked if they are matched or not a match? Since I am doing a … | |
Re: If this is a mock real-world application then you should [B]absolutely[/B] save it in a database. Wouldn't be much use to have local datafiles that no one else can access. The type of database is up to you, but relational ones (such as InnoDB) are easy to use, well documented, … | |
Re: I like using dictionaries for things like this: [code] dictionary<char,int> myDict = new dictionary<char,int>(); foreach (char c in myString) myDict[c]++; [/code] You should also note that in C# pointers must be used in an unsafe context (they will throw exceptions otherwise). And really there's not a lot of good reasons … | |
Re: Do you HAVE to use arrays? They aren't exactly tuned performance-wise for remove operations. A linked list or binary tree would be the ideal datastructures here. | |
Re: [QUOTE=ddanbe;1715571]You could start here: [url]http://msdn.microsoft.com/en-us/library/ms747437.aspx[/url][/QUOTE] If you are intending on using this for a game, I would go with Direct X or OpenGL over WPF. |
The End.