|
Guffa wrote: aeliminate wrote:
please help me.
With what?
aeliminate probably wants somebody to do his homework for him.
That's no moon, it's a space station. - Obi-wan KenobiLast modified: Tuesday, August 15, 2006 7:06:04 PM --
|
|
|
|
|
Perhaps. It's impossible to tell from the question. Perhaps he doesn't understand the assignment at all, and only need some input. Who knows.
That's why I asked.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: It's impossible to tell from the question. Perhaps he doesn't understand the assignment at all, and only need some input.
Yeah, I am not exactly sure what he's looking for as a response. Hopefully is just looking for some input to help the thought process
too much daily WTF for someone... - Anton Afanasyev
|
|
|
|
|
I have a windows service, which when its OnStop method is called, needs to do some work that may take a while. It seems like the SCM only waits a default time(20-30 seconds) before it terminates the service, whether or not it has finished its work.
I know that in the .NET Framework 2.0, there is something called RequestAdditionalTime() that can be called to change this default time, so that the SCM will wait the request period before terminating the service.
But is there something similar I can do in the .NET Framework 1.1?
Thanks in advance.
|
|
|
|
|
Hi Everybody,
I just need to know how I can make the mouse invisibile with DirectInput in C#.
Thanks,
0rigin
|
|
|
|
|
I am trying to pull data from a DB and have it prefill a form when the form is pulled up. Here is a little snippet of code that I am using. I am getting a handling error (in subject line)
public static string[] FormArgs;
public static DESClient.DESClientConnection conn;
private DESClient.DESApplicant applicant;
private string primedln = String.Empty;
int x = 0;
foreach(string arg in FormArgs)
{switch( x )
{case 4:
primedln = arg;
break;}
x += 1;
}
applicant = new DESClient.DESApplicant(conn);
applicant.setAppID(Convert.ToInt32 (primedln) );
lbName.Text = applicant.getLname()+", "+ applicant.getFname()+" "+ applicant.getMname()+".";
lbDLN.Text = applicant.getAppId() +"/"+ address.getState().ToUpper();
static void Main(string[] args)
{
Form1.FormArgs = args;
Application.Run(new Form1());
}
|
|
|
|
|
|
lbDLN.Text = applicant.getAppId() +"/"+ address.getState().ToUpper();
|
|
|
|
|
TWatson47 wrote: foreach(string arg in FormArgs)
{switch( x )
{case 4:
primedln = arg;
break;}
x += 1;
}
Why not just grab the fifth item by index ?
You need to step into this code, and work out which line is causing the error.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi guys,
I am trying to parse a date from a txt file using the following code.
while ( (sWhole = trd.ReadLine().Trim()) !=null )
{
if (sWhole =="" )
continue;
if(sWhole.EndsWith("=END="))
break;
String sDate;
Regex rDate=new Regex(".*\\d{2}/\\d{2}/\\d{4}\\s.*");
Match m5=rDate.Match(sWhole);
if (m5.Success)
{
sDate=m5.ToString();
scolDate.Add(sDate);
}
where scolDate=string collection.
When I run the file to parse the date, I keep getting an error saying "Index was out of range. Must be non negative and less than the size of the collection.
Please help!!!!
sasa
|
|
|
|
|
|
On second thought, if you don't know where in the text file the date is located, DateTime.TryParse may not work for you.
Have you looked at RegExLib.com[^]? The site is filled with hundreds of common regular expressions. Search that site for "date" and you'll get several hits.
Also, another tool that may aide you in regular expression building is the free RegExBuilder[^] tool. I highly recommend it.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: And in this corner, the Party of Allah
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
I prefer Expresso. It has dozens of useful features
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Not sure what is causing the "Index out of range"; but, your regular expression probably should be:
".*?\\d{2}/\\d{2}/\\d{4}\\s.*"
The "?" prevents the "*" quantifier from being "greedy".
- Bitwise
|
|
|
|
|
hi
How do i go about checking the format of the date that a user entered in a textbox? The date will be their date of birth. I want to make sure it is a valid date.
Please someone help me.
|
|
|
|
|
|
Judah Himango wrote: There are also regular expressions
I wouldn't like to try to write a regular expression that can check if a date is valid. Just the expression to check for the different number of days in the months would be horrific, not to speak of leap years...
---
b { font-weight: normal; }
|
|
|
|
|
I have a windows servcie application which has apart from OnStart,OnStop() only one more event and is FSWatcher_Created, where FSWatcher is FileSystemWatcher.In FSWatcher_Created eventhandler I have following code:
FileInfo file;
pathToWatch = ConfigurationSettings.AppSettings["PATHTOWATCH"];
//gets file name
fileName = Util.GetFileNameFromPath(e.Name);
//gets file path
filePath = pathToWatch+Util.GetFileNameFromPath(e.Name);
file = new FileInfo(e.FullPath);
MoveTo = ConfigurationSettings.AppSettings["PATHTOFILEMOVE"];
pathToMove = MoveTo+fileName;
if(file.Exists)
{
lock (m_SynLock)
{
file.MoveTo(pathToMove);
}
}
After installing I tested the service. When I drop a file in a designated folder(PATHTOWATCH) it immediately picks up and drops into another folder(pathToMove). If I now do the same second or third time with new file it does not move file to another folder.It seems that windows service somehow does not respond. Can anyone please explain this behaviour and tell me what should I do that it detects the new file and move to another folde?.
Thank you in advance.
Bharat Gadhia
In life, failures teach you as much as — or perhaps more than — successes.
Thank you very much for the help.
|
|
|
|
|
Wrap a try catch around your code and see if there exceptions. Also debug it in an exe project first until it works.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
hi all ,
I want to declar a varible (like int) as a golbal in Form1.cs.Can anyone guide me .
thanks .
s_mostafa_h
|
|
|
|
|
C# doesn't allow global variables. Every field is contained in a class. If you need global-like access, you can stick a static field in a static class:
public static class MyStuff
{
public static int MyVar = 15;
}
int val = MyStuff.MyVar;
To be honest though, if you're needing lots of globals, you probably have flawed design. I find static classes to be a rare need; you only truely need them for functions that have zero reliance on other classes, zero dependencies, and each function is completely self-contained with no side effects.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: And in this corner, the Party of Allah
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
I want to use it(this variable )in report Formula , is it possible ?
regards ,
s_mostafa_h
|
|
|
|
|
mostafa_h wrote: I want to use it(this variable )in report Formula , is it possible ?
A variable in a report's formula? Sure, so long as you can put the values into the formula from code, there's nothing stopping you from using a variable as input.
But I don't see how this relates to global variables.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: And in this corner, the Party of Allah
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
You can use it anywhere you like.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Using a global variable is not a good idea.
I think that it's better to use parameter objects rather than global variables.
For example if you have to pass x,y and z to a formula calculator you can have a object that gets x,y and z as parameters and then you can pass this object to a suitable metohd of your calculator.
In form1
<br />
public FormulaParams GetFormulaParameters()<br />
{<br />
FormulaParams params=new FormulaParams();<br />
params.x=int.Parse(this.txtX.Text);<br />
params.y=int.Parse(this.txtY.Text);<br />
params.z=int.Parse(this.txtZ.Text);<br />
return params;<br />
}<br />
In form2
<br />
public void Calculate()<br />
{<br />
Form1 form1=new Form1();<br />
form1.ShowDialog();<br />
int result=new Formula().Calculate(form1.GetFormulaParameters());<br />
}<br />
|
|
|
|