2,157 Posted Topics
Re: I like to use the [URL="http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx"]Stopwatch[/URL] class for timing things. | |
Re: This method will remove everything that is between < > characters, including the < and >:[code]public string StripHTML(string text) { return Regex.Replace(text, @”<(.|\n)*?>”, string.Empty); }[/code] You'll need to include [icode]using System.Text.RegularExpressions;[/icode] at the top of your code. | |
Re: [url]http://www.codeproject.com/KB/dotnet/transparent_controls_net.aspx[/url] | |
Re: No, since everything in the where clause needs to be compared to something else. What you are looking for is something like [code]SELECT * FROM smst as p WHERE p.Source = @Source AND (p.Destination = @Destination OR p.Destination2 = @Destination) AND p.sourceRoadCount+p.middleroadcount+p.destinationroadcount+p.xldestinationroad2count = (SELECT Min(t.sourceRoadCount+t.middleroadcount+t.destinationroadcount+t.xldestinationroad2count) FROM smst as t WHERE … | |
Re: You need reverse the range given, this can be done by swapping pairs of numbers until the data is reversed. Using your example, you'd swap 2 and 5, 3 and 4 and then you would be done. The following snippet is what you need in your method. [code]while (start < … | |
Re: The user of your class will need to know what type is being returned, or else how are they going to use it? They will have to know to expect a string, boolean, int, etc. Sure, they could assign it to var, but then what good is it? Should you … | |
Re: [QUOTE=ffishy;1370449]I was thinking that every number is significant in it's representation and hence, the number of entries should remain the same. Does anyone have any idea how a smaller array can be implemented to show the same data after decompression?[/QUOTE] If the number of entries are the same, then it … | |
Re: Did you try escaping the " marks [code]string mysql = "select \"cusip\", \"price structure\" from tableA";[/code] | |
Re: SqlConnection is for connection to SQL Server, not MySQL. Either use [URL="http://msdn.microsoft.com/en-us/library/system.data.oledb.aspx"]OleDB[/URL], [URL="http://msdn.microsoft.com/en-us/library/system.data.odbc.aspx"]ODBC[/URL], or [URL="http://www.mysql.com/products/connector/"]Connector/Net[/URL] | |
Re: You don't retrieve a date in a format. The database stores the date however it wants, C# stores the date however it wants. When you need to [I]display[/I] the date, then you format it. [URL="http://blog.stevex.net/string-formatting-in-csharp/"]String formating[/URL] | |
Re: Can we see the code you are using to do your insert and the type of the field the date is coming from? | |
Re: List<T>.Contains() is easier to use. [icode] if (ilst.Contains("AA")) { ..[/icode] | |
![]() | Re: For most objects the == operation just compares if they are referencing the same object, it doesn't do a 'deep compare'. You'll have to write your own method that compares the images. ![]() |
![]() | Re: You can do it either way (and even use C# as the code behind your HTML pages). You can secure access to the DB by requiring userid/password to access the database. If you go the HTML route, you'll have to learn more :) If you have specific implementation questions, don't … |
Re: Most likely you are creating a new Random object each time you execute Roll() and since (if you don't specify) Random is seeded by the time, there hasn't been enough time between the creation of the objects for the time to have changed. This is a very common problem. If … | |
Re: [QUOTE=Kimpl;1367920]You can set the variable for passing it into the first method, then use the ref keyword in the parameter field of the method to reference the parameter as the original variable, rather than creating a new copy. Here's an example: [CODE] string hh = "Bob"; Hello(hh); string x = … | |
Re: It really depends on what you are doing. If you are doing simple selects, deletes, updates, etc. then you won't notice much of a difference between the two. But, if you are doing lots of DB activity where the results from one call are used by other database calls (and … | |
Re: You make me feel old, I used to play this and converted it to BASIC at one time :) The files are the fortran source (and it looks like 3 copies of the same thing), the other is the data file. The data file format starts with the location number, … | |
Re: I don't see anywhere in your code that you declare the variable oleDbDataAdapter, which is what the error is telling you. | |
Re: [code]public void MyMethod(SomeType param1, SomeType param2) { try { // some code that sometimes errors } catch (Exception e) { // log exception and parameters here } }[/code] Is this what you mean? Your explanation isn't very clear as you claim that reflection doesn't work. | |
Re: Do you have a thumbprint scanner? Do you have an SDK or any documentation on how to access data from it? | |
Re: There are several things wrong with the code (and Kimpl left them in and added a new one). First, an if statement is not a loop. It will only execute one time then your method will end. Second, you never flush the stream. File based streams buffer data and only … | |
Re: [QUOTE=Ketsuekiame;1366329]To answer your second question, yes. It searches the string for the first instances of "|" and returns the position in the string that it finds it. Please note that the index returned is 1 based, not 0 based like arrays are. So if it's the first character in the … | |
Re: There are many ways to search a binary tree and we'll consider one here (Referred to as Left-Node-Right or LNR. There is also LRN, NLR, NRL, RLN, RNL. Half of those are just previous ones in reverse order). [code]method LNR(Node n) { if (n->left is not null) { LNR(n->left) } … | |
Re: Or you could use [URL="http://msdn.microsoft.com/en-us/library/ms754130.aspx"]Windows Presentation Foundation[/URL], that's what it's there for. | |
Re: We are here to help you with code you have written, not write code for you. What have you written? | |
Re: Execute one, make sure it worked, then execute the other. One problem you might have is if the first works and the second doesn't. That would place your database into an error state as some data would be missing. To deal with that you use the [URL="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqltransaction.aspx"]SqlTransaction[/URL] class. It allows … | |
Re: Very hard. C# depends on the CLR library being installed on the machine. You'd have to include it in your embedded system. | |
Re: The statement [icode]String b = a[/icode] copies the reference to [B]b[/B], it doesn't make [B]b[/B] reference [B]a[/B]. The next line you are setting [B]b[/B] to reference a different object (the string "Text in b"), this has no affect on [B]a[/B] (and you'll find that all object behave this way, not … | |
Re: Since you didn't use code tags, that's really hard to read and why would you include commented out code? | |
Re: Take a look at [URL="http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx"]FileSystemWatcher[/URL]. | |
Re: First off, don't check <= and also subtract one from the value being checked. It's just < and no subtraction needed (line 1 of your code). Second, you are checking if the row is null, not the items in the row. The row will never be null as that would … | |
Re: You'll probably have to make the C# code a COM object. This [URL="http://www.csharphelp.com/2006/08/building-com-objects-in-c/"]link[/URL] has an example. | |
Re: It shows bad style and incorrectly portrays some (at least) aspects of OOP. That's from looking at it for less than a minute. I suspect a full study of it would show many more problems. | |
Re: 1) You just set the controls to be visible, for example [icode]textBox2.Visible = true;[/icode] 2) Not sure what you are asking, could you explain more? | |
Re: Radio buttons have a [B]Checked[/B] property that holds a boolean value. You'll have to return a boolean to set it, maybe something like [icode]radioGender.Checked = dr("IntendBreed").ToString() == "American Shorthair";[/icode]. If you are trying to set the text of the radiobutton (and not if it is active or not), then you'd … | |
Re: If I understand you correctly what you need to look at is the [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.listcontrol.displaymember.aspx"]DisplayMember[/URL] property (It's inherited from ListControl, thus the link goes there). | |
Re: Your problem is two fold, one solved by Hyperion's code. That problem is variable scope. In your original code, you create the pplEaten variable inside an if block, so when you exit the if block it no longer exists. Hyperion moved it to a scope that spans the entire problem. … | |
Re: Use code tags and spell out words. You just make it harder to read. Your error means that the line didn't have the split character in it, use the debugger and check what is returned by your ReadLine() statement. | |
Re: Your isNumber fails on 34.2 (or any decimal number) and longs. In the various is...() methods, why do you set the regex for the opposite of what you want, then negate the result? Why not just set it to what you want and return the result? What utility does this … | |
Re: Of course, if you declare the button like darkagn did and then not assign it to the form, you'll never see it :) | |
Re: Not really. Switch/case is designed to operate off one variable, not five. You could do it, but it would look ugly. Something like this: [code]switch (e) { case true: eMethod(); break; case false: switch (a) { case true: aMethod(); break; default: break; } switch (b) { case true: bMethod(); break; … | |
Re: I would modify the Main method in Program.cs to something like: [code][STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); LoginForm lif = new LoginForm(); Application.Run(lif); if (lif.Success) { Application.Run(new Form1()); } }[/code] You'll need to add a property to your login form (in my example, Success) that lets you know if … | |
Re: According to [URL="http://msdn.microsoft.com/en-us/library/ms176057.aspx"]this[/URL] page, you need to use double quotes. | |
Re: I suspect it has to do with the thread immediately exiting when you call it. Try calling the synchronous version of the MCI command (I believe you append 'wait' to the command string). | |
Re: [QUOTE=Mitja Bonca;1360730]Anyway, as I said, Get,Set method is not meant to do any chcking (even if its possible to do it), but its meaning shows its name - so to SET something up, that you can later retive (GET) this something! Understood? And please, do not post that kind of … | |
Re: I'd need to see the object definitions for ProductFieldLookups and LookupType to really answer the question, but without seeing them it appears that pfl.LookupType isn't a collection. | |
Re: [URL="http://www.switchonthecode.com/tutorials/csharp-tutorial-simple-threaded-tcp-server"]This[/URL] should help you. | |
Re: arccos y = Pi/2 - sum((2n)!/((2^2n)*(n!)^2))*(y^(2n+1)/(2n+1) where n = 0 .. infinity and |y| <= 1. Or you could use (if you can deal with imaginary numbers): arccos x = -i * ln(x + i * sqrt(1 - x*x)) arccos x = pi/2 + i * ln(i * x + … |
The End.