2,157 Posted Topics

Member Avatar for micahgeorge

I like to use the [URL="http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx"]Stopwatch[/URL] class for timing things.

Member Avatar for micahgeorge
0
159
Member Avatar for kimlong008

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.

Member Avatar for kimlong008
-1
91
Member Avatar for christos312

[url]http://www.codeproject.com/KB/dotnet/transparent_controls_net.aspx[/url]

Member Avatar for christos312
0
146
Member Avatar for chathuD

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 …

Member Avatar for Momerath
0
121
Member Avatar for daniel-brown

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

Member Avatar for jbisono
0
91
Member Avatar for LoLFactor

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 …

Member Avatar for Momerath
0
218
Member Avatar for ffishy

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

Member Avatar for griswolf
0
115
Member Avatar for bnath001

Did you try escaping the " marks [code]string mysql = "select \"cusip\", \"price structure\" from tableA";[/code]

Member Avatar for Kimpl
0
116
Member Avatar for Yearner

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]

Member Avatar for Momerath
0
201
Member Avatar for karthikamal

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]

Member Avatar for Momerath
0
35
Member Avatar for umamahesh2020
Member Avatar for someshdhaka
Member Avatar for someshdhaka
0
2K
Member Avatar for ja0

List<T>.Contains() is easier to use. [icode] if (ilst.Contains("AA")) { ..[/icode]

Member Avatar for Momerath
0
72
Member Avatar for Arturo32

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.

Member Avatar for Arturo32
0
109
Member Avatar for arcticM

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 …

Member Avatar for Momerath
0
159
Member Avatar for tiramisu10

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 …

Member Avatar for tiramisu10
0
112
Member Avatar for aminit

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

Member Avatar for harrypalmerr
0
119
Member Avatar for sa.alavifar

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 …

Member Avatar for harrypalmerr
0
104
Member Avatar for JOSheaIV

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

Member Avatar for Momerath
0
108
Member Avatar for tet3828

I don't see anywhere in your code that you declare the variable oleDbDataAdapter, which is what the error is telling you.

Member Avatar for Momerath
0
334
Member Avatar for VIeditorlover

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

Member Avatar for divin757
0
96
Member Avatar for butt89

Do you have a thumbprint scanner? Do you have an SDK or any documentation on how to access data from it?

Member Avatar for Momerath
0
34
Member Avatar for vt2009

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 …

Member Avatar for Kimpl
0
130
Member Avatar for ekailan

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

Member Avatar for Momerath
0
194
Member Avatar for bleedi

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) } …

Member Avatar for Momerath
0
173
Member Avatar for Jazerix

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.

Member Avatar for Momerath
0
92
Member Avatar for vijaykrishnabor

We are here to help you with code you have written, not write code for you. What have you written?

Member Avatar for vijaykrishnabor
0
169
Member Avatar for AngelicOne

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 …

Member Avatar for ashishkumar008
0
97
Member Avatar for omarelmasry

Very hard. C# depends on the CLR library being installed on the machine. You'd have to include it in your embedded system.

Member Avatar for omarelmasry
0
225
Member Avatar for Poposhka

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 …

Member Avatar for ashishkumar008
0
117
Member Avatar for Lalithayadav

Since you didn't use code tags, that's really hard to read and why would you include commented out code?

Member Avatar for ashishkumar008
0
94
Member Avatar for wenlong88

Take a look at [URL="http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx"]FileSystemWatcher[/URL].

Member Avatar for Momerath
0
47
Member Avatar for braveheart_sb

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 …

Member Avatar for Momerath
0
119
Member Avatar for canadiancoder

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.

Member Avatar for canadiancoder
0
222
Member Avatar for mfaisalhayat

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.

Member Avatar for Momerath
0
41
Member Avatar for Nemo_NIIT

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?

Member Avatar for ashishkumar008
0
154
Member Avatar for AngelicOne

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 …

Member Avatar for Momerath
0
115
Member Avatar for NH1

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

Member Avatar for Momerath
0
130
Member Avatar for coastcode

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

Member Avatar for coastcode
0
109
Member Avatar for arshadziard

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.

Member Avatar for Momerath
0
189
Member Avatar for Krstevski

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 …

Member Avatar for Momerath
1
245
Member Avatar for ohgee

Of course, if you declare the button like darkagn did and then not assign it to the form, you'll never see it :)

Member Avatar for darkagn
0
117
Member Avatar for DaveTran

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

Member Avatar for DaveTran
0
161
Member Avatar for Klaurac

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 …

Member Avatar for Momerath
0
116
Member Avatar for pakunoda

According to [URL="http://msdn.microsoft.com/en-us/library/ms176057.aspx"]this[/URL] page, you need to use double quotes.

Member Avatar for Momerath
0
108
Member Avatar for sah

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

Member Avatar for Momerath
0
132
Member Avatar for christos312

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

Member Avatar for christos312
0
208
Member Avatar for davidbrennan

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.

Member Avatar for davidbrennan
0
114
Member Avatar for krosty4782

[URL="http://www.switchonthecode.com/tutorials/csharp-tutorial-simple-threaded-tcp-server"]This[/URL] should help you.

Member Avatar for krosty4782
0
179
Member Avatar for mikaandy83

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

Member Avatar for Momerath
-1
186

The End.