2,157 Posted Topics
Re: Why do you care if they are quote enclosed? You only do that for strings, not for other data types. | |
Re: This is a poorly designed method. In line 3 it does a Regex match (IsMatch) then repeats the same match in the very next line (6). Regex is slow, do the matching once and save it. It does this again in lines 9 and 11. Line 20 if nurl is … | |
Re: Sure is, just add the interface IComparable to your Card class, then use the build in Array.Sort. | |
Re: RemoveAt has no return value (void is not a return value) but you try to return it in your last line. If you want to return and remove the first card, you'll need to place it in a temp variable, remove it from the list, then return the temp variable: … | |
Re: Where is 's' defined? Why are you starting it as a process? | |
Re: I'd use Double.TryParse as you can skip the try/catch exception. | |
Re: [icode]File.Copy(source, dest, true)[/icode] attempts to overwrite files that already exist (that's what the true part means). It will fail if you can't overwrite the file (it's set to read only, for example). [icode]FileInfo.CopyTo(dest)[/icode] does not overwrite files, so it doesn't generate the same errors. You could change the first to … | |
Re: [QUOTE=BobS0327;1778602][CODE]foreach (string file in Directory.GetFiles(path, pattern)) { SearchResults.Add(file); }[/code][/quote]I'd have done this a little different by getting rid of the foreach:[code] SearchResults.AddRange(Directory.GetFiles(path, pattern));[/code] | |
Re: Just do your select and order the results by parent category and category. Write a loop, break the results when one of them change. For example, your SQL would be something like[code]SELECT a.Category as Parent, b.Category as Category, c.Food as Food FROM Category a, Category b, Food c WHERE a.id … | |
Re: Right click on References in the Solution Explorer. Select "Add Reference" Select the .NET tab Select System.Runtime.Remoting Click "OK". | |
Re: Is this a 'commercial' application? If so, get permission from Adobe to bundle their installer with yours. You'll probably need a better installer than the free one you get with VS. If it's an in-house application just instruct them to install adobe reader first. | |
Re: My version of problem 1: [INDENT]N <-- 1 DOWHILE N <= 20[INDENT]NUMBERS (N) <-- (2 - (N modulus 2)) N <--- N + 1[/INDENT]ENNDO[/INDENT] | |
Re: I believe the command is [b]gacutil -I "C:\full path\to\your\dll\along\with\the\name.dll"[/b] [URL="http://msdn.microsoft.com/en-us/library/dkkx7f79.aspx"]Here[/URL] is the documentation on installing to the GAC | |
Re: [url]http://www.codeproject.com/Articles/18229/How-to-run-PowerShell-scripts-from-C[/url] | |
Re: This is because the Paint method of pictureBox is only called if it has to redraw the PictureBox. Try doing your two clicks, minimize the form then restore it. Add this to the 'else' part of your MouseClick event: [code]((PictureBox)sender).Refresh();[/code] | |
Re: Each machine will have its own unique IP address *internal* to the LAN. You can use the internal IP to connect machines *on the same LAN* together. If you are trying to get outside machines to connect to internal machines, you'll have to configure your router to use Port Forwarding, … | |
Re: Using the [URL="http://msdn.microsoft.com/en-us/library/88c54tsw.aspx"]sealed[/URL] modifier you can prevent someone from overriding your methods. And, of course, using abstract will force them to implement a method. virtual will allow them to override, but not require it. | |
Re: Depends on what database you are using. For SQL Server [URL="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executescalar.aspx"]this[/URL] page is the command you want, and it even has an example. | |
Re: You can use IndexOf:[code]String myString = (new StreamReader(response.GetResponseStream()).ReadToEnd(); int n = myString.IndexOf("Auth="); if (n >= 0) { // Make sure we found it at all String token = myString.SubString(n+5); // +5 to skip the "Auth=" ... process token }[/code] | |
Re: No, it's not right. In most cases it will generate an exception (null reference) unless you have a specialized 'leaf' node that implements different code for iPathLength (for example, some implementations of Red-Black trees use a specialized leaf node). | |
Re: Line 65 in your code requires that you press a key for each time the loop runs. Remove it. | |
Re: What do you want to do if the number requires more digits, as in '1024 KB'? Setting the number of digits after the decimal is easy, or the minimum number before the decimal. Setting a specific size doesn't always work right. | |
Re: OleDb doesn't use @ parameters in the SQL statement, you need to replace them with ? so your statement will look like [code]string sql = "UPDATE Orders SET Status=? WHERE OrderID=?";[/code] You can add the parameters just like you have them now, you just have to remember to add them … | |
Re: Line 28 generates a compiler error and I'm not sure why you even have it there in the first place. Other than that I don't see obvious errors. | |
![]() | Re: Having one form directly change the appearance of another form is bad OO design. It couples the forms tightly. You should pass back information to the form so it can change itself. That said, by default C# controls are private. If you click on the control and look in the … |
Re: [QUOTE=darkagn;1771004]The SetResolution function accepts to float's as parameters, you are passing to int's.[/QUOTE] Since the range of integers is smaller than the range of floats the system will [URL="http://msdn.microsoft.com/en-us/library/y5b434w4%28v=vs.90%29.aspx"]implicitly cast[/URL] them for you. This isn't the problem. | |
Re: Shyla Last Activity: Jun 23rd, 2011 Don't hold your breath. And this thread is almost a year old. | |
Re: Because floating point numbers aren't exact (in most cases) you need an error margin, usually called 'epsilon', to let you know when you are done. I'm not sure what formula you are using there, but here's one that works (Note: It requires a power function, otherwise how can you test … | |
Re: In your first block of code, you declare a new dbData in line 25. Where in your code do you pass that back to the calling code? You don't. So the dbData you declare in line 15 of the last block of code has no relation to the other dbData … | |
Re: [code]// Fisher-Yates shuffle, also known as Knuth shuffle vett[0] = 1; for (int i = 1; i < vett.Length; i++) { j = rand.Next(0, i + 1) // because we are dealing with integers, we can use the xor-no-temp swap vett[i] ^= vett[j]; vett[j] ^= vett[i]; vett[i] ^= vett[j]; // … | |
Re: Read [URL="http://beginnersinvest.about.com/od/incomestatementanalysis/a/double-declining-balance-depreciation-method.htm"]this[/URL], it explains it well I believe. | |
Re: You don't include SQL Server 2008 R2 in your setup, they'll have to install that too since they'll need their own license to run it. | |
Re: You have the formula right, you have the results wrong. Remember, for every quadratic equations there are two roots (that's what the +- in the first line of the equation you posted. You need to either add or subtract the determinant). Since it is possible that the results require the … | |
Re: What is the value of d? Why are you casting it into a numeric rather than using the SqlParameter to set the type? What happens when [B]a[/B] isn't 0 or 1? All those if statements are confusing, why don't you build the CommandText based on the values of a, b, … | |
Re: Let's take a look at a short piece of code that will always generate an exception. [code]int a = 100; int b = 0; int c = a / b;[/code] The code generated by my compiler looks like this:[code] int a = 100; 00000000 push ebp 00000001 mov ebp,esp 00000003 … | |
Re: What you are talking about is [URL="http://msdn.microsoft.com/en-us/library/aa288467%28v=VS.71%29.aspx"]operator overloading[/URL]. Let's say you want to define '+' for your type to mean that the x values are added together, and the y values are added together. You'd do something like this: [code]public static CustomType operator +(CustomType r1, CustomType r2) { return new … | |
Re: Why go through all the variable manipulation: [code]Public Shared Function getCurrentDateTimeString() As String ' Returns current date and time in this format: "yyyyMMddHHmmssff" return DateTime.Now.ToString("yyyyMMddHHmmssff" End Function[/code] | |
Re: Do you know how to open a file? Do you know how to split strings? Do you know how to convert strings to other types? Have you done any work at all? | |
Re: Priority won't help you here. Just execute them in one (1) Backgroundworker, calling each method in turn. | |
Re: [QUOTE=skatamatic;1769618]Hmmm do you know how to build a string (or list of strings) out of these numbers? [code] private string GetEvenNums(int Min, int Max) { string returnString = ""; for (int i = Min; i <= Max; i++) if (i % 2 == 0) returnString += i.ToString() + Environment.Newline; return … | |
Re: What's the value of doCarrier.ColumnName? | |
Re: Do you want to store the Intptr (useless) or the information it's pointing at? Storing the value of the pointer doesn't get you anything as, most likely, what you want won't be in the same spot of memory next time. | |
Re: Read [URL="http://www.techtalkz.com/c-c-sharp/115668-accessing-unc-file-share-credentials.html"]this[/URL] thread, it has some code in the 6th message and some followup after. | |
Re: Well, you've created an array of Event so you can only store Event in the array. Event has a property, ListOfAthletes, which is a string. So you create an Event object, assign the string to ListOfAthletes, and then store the Event object: [code]Event newEvent = new Event(); newEvent.ListofAthletes = Console.ReadLine(); … | |
Re: You don't have to use WCF, you can develop your own methods of sending data using sockets, http, ftp, etc. | |
Re: Why not just use [URL="http://msdn.microsoft.com/en-us/library/system.security.cryptography.protecteddata.aspx"]ProtectedData[/URL] class from .NET? They do the exact same thing. Otherwise you can declare in your C# code that CRYPTPROTECT_PROMPTSTRUCT is a class and pass null. | |
Re: I'd ask on the forums of the place you got it from. | |
Re: use [ code ] [ /code ] tags (without the spaces. It's hard to read that mess. How are you running this? From inside Visual Studio? What database are you using? Are you running in Debug mode? You do realize that your update statement will affect every record in the … | |
Re: The FormClosingEventArg has a CloseReason property, which has one of the CloseReason Enumeration values. Check MSDN for documentation. | |
Re: [code]PingReply pingStatus = ping.Send("google.com");[/code] When you are offline it can't resolve the name "google.com" thus you get an exception. |
The End.