624 Posted Topics
Re: [QUOTE=thines01;1704880]You can store your connection string in a dll and link it to your program. You would only need to change your main program if the database brand changes.[/QUOTE] Why a dll? A registry entry or a config file (xml or ini) would be more robust. This way, a human … | |
Re: Strategy games (or 3d games if you have patience and artistic talent) are always good learning exercises. Once you have the game built, creating an AI that can beat you is the next learning step. Chess comes to mind... (Although C# isn't exactly the ideal language for AI programming - … | |
Re: If the document is encrypted already, I don't really see the point in sending it with SSL. | |
Re: That XML seems a bit flawed. The way it's set up there can really only be 1 application added. [code=xml] <root> <software> <software_entry name="My Program" path="C:\MyPath\" type="msi">My Program</software_entry> <software_entry name="My Program2" path="C:\MyPath2\" type="msi">My Program 2</software_entry> </software> </root> [/code] Makes more sense to me. Although I'll admit I tend to abuse … | |
Re: If you want the second namespace to know about form1, you need to reference it with a using statement at the top of the code. Then instead of having a generic object member, it can be of type Form1, and this should solve your problem of not being able to … | |
Re: [QUOTE=alaa sam;1704037]what I want is to show another form within the same application I will try what you suggested thank a lot I really appreciate it[/QUOTE] As in an MDI form? | |
Re: People here will not do your homework for you. Especially if you just copy and pasted it from an assignment. At least put in the the effort to make it seem like it's you asking the question and not a prof. | |
Re: [QUOTE=gusano79;1698972]If you want to check for collisions between munchies, one way to do it is to use two loops, along these lines: [CODE]for(int i = 0; i < noOfMunchies - 1; i++) { for(int j = i; j < noOfMunchies; j++) { // Check for collision between munchies i and … | |
Re: For computer name: [icode]Dns.GetHostEntry(stringIP).HostName[/icode] should work. For the ip, I've used this before: [code] string sIP = (mySocket.RemoteEndPoint.ToString().Split(':'))[0]; IPAddress tempIP = IPAddress.Parse(sIP); [/code] This will seperate the port number from the IP in the RemoteEndPoint, then will parse this as an IP address. Though there might be a better way … | |
Re: In the new C# you can make fields into automatic properties, and apply public/private/protected/internal/etc accessors to them: [code] int myInt { public get; protected set; } [/code] Pretty sweet imo. Really not sure how much overhead is involved in doing this though... | |
Re: Spying on other processes is not very trivial. I think Microsoft did this on purpose to make writing malicious code not all that easy to do. I am not overly familiar with the API's you are talking about, but suspect they come from the USER32.dll library. Though I strongly suspect … | |
My boss asked me to write a PID class to control a motor today. No big deal, except that the deadline is tommorow evening. My calculus is rusty, and my vb6 is probably worse (which is the language I am to use). Anyone have a good understanding of a PID … | |
Re: To avoid unexpected results, it helps to cast all variables to a common datatype prior to performing calculations: [code] double percentage[] = new double[1]; percentage[0] = Math.Round (((double)analysis[i] * 100d) / (double)char_count); [/code] Furthermore, it makes more sense to only perform rounding as the last step - such as displaying … | |
I am just wondering if anyone has any pointers on how to index my database. It's for a piece of instrumentation software that loads in large amounts of sensor data (sometimes over 3 days worth of recording at 1 second intervals for 90 sensor's doubles). Right now it can load … | |
Re: Hate to revive an old thread, but this might be of value to the OP: [code] string myPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); [/code] If you use this instead of a hardcoded path to your files it won't matter if the actual path changes between computers. It's worthwile to make yourself familiar with … | |
Re: Explicit Casting: [code] try { Control myControl = (Control)myObject; } catch { //Object did not conform to Control class...Do something about it. } [/code] | |
I am trying to write a somewhat generic class for calculating rolling averages. It's generic in the sense that it needs to support all numeric datatypes (int, double, short and long). I'm a bit of a noobie to VB.Net and have run into a problem: [code] Public Class RollingAverage(Of T) … | |
Re: Sounds like you should look into multithreading. Running the UI on one thread and the background work on one or more threads is fairly common practice these days. | |
Re: One simple way to keep track of which forms are loaded would be to have a call in their On_Load events to increment a variable in a static class. If you know the total number of forms to load, you can use this number to evaluate the percent loaded. Keep … | |
Re: Well this really depends - will it always accept input in EXACTLY this form: (constant+/-constant*j)*(constant+/-constant*j) ? If this is the case, you won't need to get too fancy. If you want it to parse ANY equation that is a different story. | |
Re: There is a class (I think it is under System.SerialPort but I could be wrong) that has events which fire when data is received. All the nasty work already done for you. (Although there ARE a few problems with the class that I have notice) | |
Re: Me and my two roomates rock the shit out of DotA! We usually win too because other people have to type to talk to their team and we can just talk to eachother :P It's pretty much the only game I play though...too much work to do! | |
Re: Look into encryption. There's TONS of material available for it (probably more than most other programming subjects). | |
Re: Sounds like [URL="http://www.codeproject.com/KB/cs/csharpintro01.aspx"]polymorphism and base class inheritance[/URL] may be your friend here, although using interfaces is just as valid. If you need any help with these concepts, post your specific questions here =) | |
Re: What do you mean by bounce? The simplest form of making a ball bounce would be to invert the x or y speed each time it hits an edge (x for vertical collision, y for horizontal). For example: Ball moving at 2 x pixels per tick and 5 y pixels … | |
Re: I would be seriously choked if I only got 60k a year. I am pretty sure that's what labourers make that dropped out of highschool. I live in Canada but I am pretty sure technology fields pay about the same between us and the US though we have no technology … | |
Re: Why do you have 2 differently seeded random classes? Would 1 not suffice? | |
Re: Those are overloaded binary operators. Basically you are specifying what myClass1 > myClass2 really means. For example, say you had a class that contains 2 integers, a and b. If you wanted to implement some functionality that compared the two classes (for example a greater than > operator) your computer … | |
Re: I've used this snippet before: [code] private void Form1_Load(object sender, EventArgs e) { //Hide our form from user this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); this.TransparencyKey = Color.FromKnownColor(KnownColor.Control); this.Update(); } [/code] Who the hell knows why microsoft decided that by default forms dont support a transparent back color... | |
Re: [URL="http://www.codeproject.com"]This [/URL] site has some good tutorials and examples to learn from. Chances are you will be learning to write console apps before you learn to write windows apps, althought it seems like you won't be able to write that (very easily) in a console app. | |
Re: Please don't clutter the internet with more malware... | |
Re: Hmmm it may be possible that you have multiple radio boxes subscribing to this event (I suspect there are 2). If that is the case, when you click a radio button it will fire the event since the button's checked value will change. But the nature of a radio button … | |
Re: If you solve this problem - you will be a rich man. Just look at licensing for games. There has yet to be one method of this type of security that hasn't been broken. (Although online validation seems to be pretty solid) The MAC you grabbed is probably the first … | |
Re: [QUOTE=bettybarnes;1672286]Thanks for the replies.. How about if i wanted to delete the last text input in the textbox say for example the characters inside the textbox is: LATER. I want to remove the last letter R. How will i do this in C#?[/QUOTE] Think about how you would do it … | |
Re: Perhaps do something related to what you've been LEARNING ALL YEAR. | |
Re: That is an explicit cast. Basically you are forcing the cpu to consider the control that is found on the grid to be a textbox. This is because the FindControl() function returns an object of type Control. A textbox is derived from a Control so the cast works, and is … | |
Re: Windows doesn't like the win32 api RemoteThread() call anymore. But as far as getting 'winject.exe' to work - it probably needs some command line arguments, as you are in no way specifying the dll to inject. Check the documentation. Also, don't cheat in online games (unless you are just trying … | |
Re: [URL="http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.aspx"]Regex[/URL] would work great for that. But really - there shouldn't be any other files starting with 'host' in that folder so it may be overkill. | |
Re: [CODE]if value > trackbar.maximum then trackbar.value = trackbar.maximum[/CODE] It's pseudocode, but should do the trick. | |
Re: Sorry if this doesn't help solve the problem, but why exactly are you using this ID schema? | |
Re: Books are [B]definately not[/B] the fastest way to learn a programming language (unless you read extremely fast). I have a 700 page C++ book that only teaches up to polymorphism. You need 2 more 700+ page books to learn STL, templates, windows api, etc. Are you familiar with any other … | |
Re: The COM interop for excel is REALLY crappy for some reason. I wrote a class that loads in at max 100x100 grid. Takes about 45 seconds to load it...... I didn't use OLE, I used the interop, but I suspect they are similarly bad. You can try using the COM … | |
Re: Yes. You will need to look into [URL="http://www.marten-online.com/csharp/simple-custom-event-handling.html"]event programming[/URL] though. I suspect you are using a Direct3D environment - if this is the case you may want to set up an on-click event for the 3D area, then inside that event use Ketsuekiame's method of finding which object was clicked … | |
Re: Networking is, in my humble opinion, boring as hell! You will understand when you finish subnetting your 500th network or setting up a huge stack of cisco switches only to be avoided in the coffee room at lunch time because your just the network room 'geek'. Not to mention the … | |
Re: From what I remember C++ was a good time. But C# blows it out of the water if you like getting your work done in time for beers and the hockey game. | |
Re: Here's some code I wrote to get data from an excel file... To add the reference go to Project->Add Reference then find Microsoft.Office.Interop.Excel under the .Net tab. Note I think you need to have excel (or maybe just any office product) installed in order for this reference to be available. … | |
Re: You are missing 2 closing curly braces at the end. One should close the class, the other should close the namespace. | |
Re: How do analog phone lines know when someone has picked up? Seeing as they only use 2 wires (sig and ground) there are no control signals for things like picking up a phone. I suppose it can be determined based on the frequency (if the prominent frequency does not conform … | |
Re: On line 84: Thread.Sleep(1000) will likely be causing the lag. Every time you paint the form you pause the thread for a whole second. What is the reason behind this? Also, you shouldn't need a refresh() in the target() method. | |
Re: Well, are you storing the user data in a class of any sort? Or is it being loaded directly from a database to the datagrid? What does FindMember() do? I would think that it finds a member...so could you not use that do determine if the member already exists (ie … |
The End.