2,157 Posted Topics

Member Avatar for apals

Why do you care if they are quote enclosed? You only do that for strings, not for other data types.

Member Avatar for apals
0
613
Member Avatar for tendaishava

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 …

Member Avatar for thines01
0
234
Member Avatar for priyanka85

Sure is, just add the interface IComparable to your Card class, then use the build in Array.Sort.

Member Avatar for skatamatic
0
207
Member Avatar for priyanka85

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: …

Member Avatar for Dani
0
163
Member Avatar for skp03
Member Avatar for Mitja Bonca
0
225
Member Avatar for zukazen
Member Avatar for zukazen
0
150
Member Avatar for sheenarbw

[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 …

Member Avatar for danimal1
0
1K
Member Avatar for skp03

[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]

Member Avatar for thines01
0
317
Member Avatar for Srcee

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 …

Member Avatar for thines01
0
172
Member Avatar for otengkwaku

Right click on References in the Solution Explorer. Select "Add Reference" Select the .NET tab Select System.Runtime.Remoting Click "OK".

Member Avatar for otengkwaku
0
132
Member Avatar for gogs85

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.

Member Avatar for gogs85
0
102
Member Avatar for kdeep

My version of problem 1: [INDENT]N <-- 1 DOWHILE N <= 20[INDENT]NUMBERS (N) <-- (2 - (N modulus 2)) N <--- N + 1[/INDENT]ENNDO[/INDENT]

Member Avatar for Momerath
0
1K
Member Avatar for surajrai

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

Member Avatar for Momerath
0
274
Member Avatar for gameover9

[url]http://www.codeproject.com/Articles/18229/How-to-run-PowerShell-scripts-from-C[/url]

Member Avatar for gameover9
0
178
Member Avatar for Sibuns

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]

Member Avatar for Sibuns
0
2K
Member Avatar for pseudorandom21

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, …

Member Avatar for BobS0327
0
124
Member Avatar for zachattack05

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.

Member Avatar for zachattack05
0
84
Member Avatar for cchacholiades

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.

Member Avatar for vimit
0
4K
Member Avatar for snehil_khanor

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]

Member Avatar for Momerath
0
279
Member Avatar for vuquanghoang

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).

Member Avatar for Momerath
0
140
Member Avatar for kiail
Member Avatar for Momerath
0
166
Member Avatar for emreozpalamutcu

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.

Member Avatar for emreozpalamutcu
0
167
Member Avatar for strRusty_gal

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 …

Member Avatar for Mitja Bonca
0
319
Member Avatar for kiail

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.

Member Avatar for Momerath
0
274
Member Avatar for CriticalError

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 …

Member Avatar for Momerath
0
162
Member Avatar for walid86

[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.

Member Avatar for walid86
0
471
Member Avatar for shyla

Shyla Last Activity: Jun 23rd, 2011 Don't hold your breath. And this thread is almost a year old.

Member Avatar for moecowboy
0
130
Member Avatar for lxXTaCoXxl

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 …

Member Avatar for Momerath
0
159
Member Avatar for thiemebr

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 …

Member Avatar for Momerath
0
443
Member Avatar for AleWin

[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]; // …

Member Avatar for ddanbe
0
416
Member Avatar for ipodtrip

Read [URL="http://beginnersinvest.about.com/od/incomestatementanalysis/a/double-declining-balance-depreciation-method.htm"]this[/URL], it explains it well I believe.

Member Avatar for Momerath
0
550
Member Avatar for ahmed elweshahy

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.

Member Avatar for Mitja Bonca
0
104
Member Avatar for lxXTaCoXxl

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 …

Member Avatar for skatamatic
0
301
Member Avatar for arbazpathan

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, …

Member Avatar for arbazpathan
0
155
Member Avatar for Traps

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 …

Member Avatar for Rashakil Fol
0
372
Member Avatar for lxXTaCoXxl

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 …

Member Avatar for skatamatic
0
159
Member Avatar for JJCollins

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]

Member Avatar for Wel Da gr8
0
2K
Member Avatar for jumboora

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?

Member Avatar for jumboora
0
264
Member Avatar for sah

Priority won't help you here. Just execute them in one (1) Backgroundworker, calling each method in turn.

Member Avatar for Momerath
0
438
Member Avatar for Galindo

[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 …

Member Avatar for skatamatic
0
263
Member Avatar for LELE7
Member Avatar for saneeha.nust

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.

Member Avatar for saneeha.nust
0
98
Member Avatar for saneeha.nust

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.

Member Avatar for saneeha.nust
0
161
Member Avatar for TrueCoding

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(); …

Member Avatar for Mitja Bonca
0
415
Member Avatar for codex89

You don't have to use WCF, you can develop your own methods of sending data using sockets, http, ftp, etc.

Member Avatar for Ketsuekiame
0
96
Member Avatar for saneeha.nust

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.

Member Avatar for Momerath
0
216
Member Avatar for saneeha.nust
Member Avatar for uva1102

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 …

Member Avatar for uva1102
0
533
Member Avatar for priyamtheone

The FormClosingEventArg has a CloseReason property, which has one of the CloseReason Enumeration values. Check MSDN for documentation.

Member Avatar for makdu
0
562
Member Avatar for amir84

[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.

Member Avatar for Momerath
0
171

The End.