Forum: C# May 4th, 2008 |
| Replies: 6 Views: 3,819 Yes, because you must use the window handle of the Application:
theprocess.MainWindowHandle
use that one... |
Forum: C# Apr 27th, 2008 |
| Replies: 8 Views: 1,934 Here:
RegistryKey subKeys = HKCU.OpenSubKey("Software\\VB and VBA Program Settings\\Company\\", true); |
Forum: C# Mar 1st, 2008 |
| Replies: 7 Views: 2,804 What?:D That timer is certainly NOT out of class.
That's completely wrong. What do you think methods like Control.BeginInvoke() are there for? It's absolutely possible to use UI controls in a... |
Forum: C# Nov 29th, 2007 |
| Replies: 5 Views: 1,259 Try to correct that one by yourself, the answer is right there in the code, have a look at how i handle the other case (it's exactly the same), we're not here to chew you every piece in advance... |
Forum: C# Nov 25th, 2007 |
| Replies: 5 Views: 1,259 Here is corrected source:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Net;
using System.Net.Sockets;
using System.Reflection; |
Forum: C# Nov 17th, 2007 |
| Replies: 1 Views: 4,600 There are overloads for that method,
have a look here : http://msdn2.microsoft.com/en-us/library/wcxyzt4d.aspx
should be the one you need |
Forum: C# Nov 6th, 2007 |
| Replies: 8 Views: 5,877 That is of course only in case FieldName is of type string |
Forum: C# Nov 5th, 2007 |
| Replies: 8 Views: 5,877 The short-circuit is working right, however your code is not, a short-circuit evaluation should be written like this :
if ((cr.FieldName == null) || (cr.FieldName.Length == 0))
... |
Forum: C# Nov 4th, 2007 |
| Replies: 8 Views: 5,877 So basically you think c# doesn't support short-circuit evaluation ?
Have a look here: http://msdn2.microsoft.com/en-us/library/2a723cdk(VS.71).aspx
@iamthwee: Those kind of answers are not very... |
Forum: C# Oct 10th, 2007 |
| Replies: 1 Views: 2,119 Try this:
string[] lines = Regex.Split(s, "(.+?)(\\*{0,13}RECIVED MAIL)\\s*(PQR.+)(New PQR.+)(Respond.+)"); |
Forum: C# Sep 25th, 2007 |
| Replies: 12 Views: 10,156 Just for the gallery, see first part of code in my previous post:
string format = "MM.dd.yyyy HH:mm:ss";
lines.Sort(new Comparison<string>(delegate(string a, string b)
... |
Forum: C# Sep 25th, 2007 |
| Replies: 12 Views: 10,156 When you catch the exception you should output its message, and not "blabla..is not a valid image file". That way you'll be able to identify what's going wrong. |
Forum: C# Sep 19th, 2007 |
| Replies: 2 Views: 1,226 This is usually done with recursion:
void Fetch (string SourceString)
{
arrayCount = 0;
DirectoryInfo di = new DirectoryInfo(SourceString);
... |
Forum: C# Sep 13th, 2007 |
| Replies: 12 Views: 10,156 Hi, if every line starts with the date, this should do the trick:
List<string> lines = new List<string>();
using (StreamReader r = new StreamReader(new... |
Forum: C# Sep 12th, 2007 |
| Replies: 2 Views: 3,388 What i don't understand in your code is that you first format the DateTime to a string and then you construct another DateTime object from that same string; is that step absolutely necessary? By... |
Forum: C# May 7th, 2007 |
| Replies: 4 Views: 5,349 Have a look at http://msdn2.microsoft.com/en-us/library/microsoft.win32.registrykey.openremotebasekey.aspx |
Forum: C# Apr 10th, 2007 |
| Replies: 2 Views: 7,903 You can do something like this:
if (st.ToLower().Contains(data.ToLower())) |
Forum: C# Apr 2nd, 2007 |
| Replies: 1 Views: 2,369 http://msdn2.microsoft.com/en-us/library/ms180903(VS.80).aspx |
Forum: C# Mar 23rd, 2007 |
| Replies: 9 Views: 5,887 It's possible that your custom RandomNumberGen class is not seeded properly, where is the seed set? |
Forum: C# Mar 17th, 2007 |
| Replies: 1 Views: 16,374 This is because you instantiate the stringbuilder object via
strbuild = new StringBuilder();
in the loop, you have to instantiate it outside when you first declare it
StreamReader reader =... |
Forum: C# Jan 20th, 2007 |
| Replies: 7 Views: 5,071 This is because you call ToString on type string instead of long.
Make sure your code looks like this:
long num = 4445556666;
string s = num.ToString("(###)-###-####"); |
Forum: C# Jan 9th, 2007 |
| Replies: 5 Views: 2,294 I would do this via regex, here's some example:
static void Main(string[] args)
{
const string theRegexString = "quote\\.jsp\\?symbol=([^=>]+)\\s*>";
Regex regex = new... |
Forum: C# Jan 6th, 2007 |
| Replies: 5 Views: 2,294 It's waiting for the user to press the ENTER key here, so it stops |
Forum: C# Dec 16th, 2006 |
| Replies: 9 Views: 3,905 Ok, i think it should be quicker now, i introduced some cryptor class with own progressbarupdatehandler. There's still some work for you to do though, mainly the way how you get the filepaths from... |
Forum: C# Dec 15th, 2006 |
| Replies: 9 Views: 3,905 It would help us if you would paste use the complete source code, otherwise it's hard to recreate your problem (and eventually help you). |
Forum: C# Sep 5th, 2006 |
| Replies: 3 Views: 3,284 have a look at that:
http://msdn2.microsoft.com/en-us/library/system.threading.waithandle.aspx |
Forum: C# Jun 14th, 2006 |
| Replies: 1 Views: 4,269 I don't see where you actually declared your delegate ?
somewhere in the namespace put this:
public delegate void ProcessingCompleteDelegate();
also to fire an event you usually do it like... |
Forum: C# Apr 27th, 2006 |
| Replies: 1 Views: 2,424 What about having a look at Convert.ToBase64String and Convert.FromBase64String ? |
Forum: C# Apr 17th, 2006 |
| Replies: 7 Views: 3,438 Yes, and to populate the int array of the Arrays class you could either pass an int array in the ctor of the Arrays class or expose a setter via the MyArray property. |
Forum: C# Apr 16th, 2006 |
| Replies: 7 Views: 3,438 Hi, i don't know exactly what you want to do there, but if you want only to make your int array public by a property you could do this in your class:
public int[] MyArray
{
get
{
return... |
Forum: C++ Apr 12th, 2006 |
| Replies: 4 Views: 2,445 try this solution:
bool SortBylength(const string& a, const string& b)
{
if (b.length() > a.length())
{
return true;
}
return false; |
Forum: C# Apr 6th, 2006 |
| Replies: 10 Views: 5,878 Refining tayspen's example a bit ( i hope he doesn't mind):
private bool IsNumeric(string input)
{
bool isNum = true;
try
{
int.Parse(input);... |
Forum: C# Apr 5th, 2006 |
| Replies: 10 Views: 5,878 Or just put that code into a try/catch block and output the error message or a custom message |
Forum: C# Mar 30th, 2006 |
| Replies: 2 Views: 3,309 // generate exception
catch (DivideByZeroException e)
{
// handle exception
} |
Forum: C# Mar 11th, 2006 |
| Replies: 13 Views: 18,498 http://www.codeproject.com/csharp/highperformancetimercshar.asp |
Forum: C# Jan 28th, 2006 |
| Replies: 4 Views: 3,126 well, to make registry access read only you could log into your windows without admin rights :P
another thing maybe would be to store that data in a file and fiddle with the security rights of it... |
Forum: C# Jan 12th, 2006 |
| Replies: 9 Views: 19,614 \s+ is a regular expression, the \s means to consider whitespaces and the + means to consider at least 1 occurence or more of them |
Forum: C# Jan 11th, 2006 |
| Replies: 21 Views: 11,880 |
Forum: C# Jan 11th, 2006 |
| Replies: 9 Views: 19,614 string [] split = System.Text.RegularExpressions.Regex.Split(contents, "\\s+", RegexOptions.None);
split is already a string array |
Forum: C# Jan 9th, 2006 |
| Replies: 9 Views: 19,614 StreamReader objInput = new StreamReader("C:\\values.dat", System.Text.Encoding.Default);
string contents = objInput.ReadToEnd().Trim();
string [] split =... |