|
I know you've been told this before, but, read this[^]. The many levels on which this shows that you have no idea how C# works, are hard to fathom.
I know people like you don't want to learn, you want your job done for you. So, here goes.
1 - your variable naming is a disaster. Never use the default names. Especially if you 51 different variables that are all called addrow.
2 - like the error says, you can't use > to compare strings. It certainly isn't going to do what you're expecting. Are you generate validating this text to make sure it conforms to the format you're hoping for ? You need to do that first, then you need to turn this into a format such as datetime ( although not sure if you can make a datetime without a date, I'd be more inclined to use string.split and int.TryParse to work out what you were dealing with )
I suspect you have no idea what I just said. If so, it proves again that you need to read some basics before you write code that is ever going to be used by anyone, and if anyone is paying for your code, you are stealing from them.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Ease back Chris, you've blown the trans-axle!
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
I'm sorry, but *seriously*....
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I agree, and your post cracked my sh*t up, just had to throw some Aliens quote in there (use it or lose it!) Do you think we should even bother telling him/her about CompareTo or DateTime.TryParse/Parse, et al?
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
I dunno if DateTime.TryParse will work with just a time ? I tried to give a pretty straightforward answer, I think the best way to enforce this format, and to check the value, is to split the string and do an int.TryParse on the different values.
Even when I blast someone for utter laziness and cluelessness, I try to provide an answer they can use, if they are willing to read it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
TryParse does work with just a time, it defaults to the current system date.
So this works, although it seems a bit complex:
string userText = "12:59";
DateTime now = DateTime.Now;
DateTime checkTime = new DateTime(now.Year, now.Month, now.Day, 12, 59, 0); // assuming 12:59am
DateTime userTime = DateTime.MinValue;
DateTime.TryParse(userText, out userTime);
if (userTime > checkTime)
{
// Valid
}
else
{
// Invalid
}
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
OK, well, I guess he got his answer then Thanks, I had no idea and I didn't like to do more work for an answer than the OP was willing to do for himself. But, it's good to know.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Oops! Yeah, I shouldn't do that, fully agree (especially with the level of questions being posted these days). But, curiosity killed my cat, so I had to know. Plus we all learned something.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Christian Graus wrote: DateTime.TryParse will work with just a time
How about a tweak of current Date plus time as string and then passing them to DateTime.Parse()? I admit care should be taken for time between 23:59 and the next days particularly in time-sensitive applications.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
|
ASP.NET C Sharp User Info Snag
Suppose I write a asp.net app using c sharp and I want to have a look at some user information. How would I go about doing this? i remember in good ol' html and dhtml there was a way of peeking at the information packet sent to the server. I remember it was called "sniffing". But I don't recall how it is done. How do I snag the user's information?
|
|
|
|
|
Probably on the Request object.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I want to add a progress bar to my button click event, since the Button_Click event in code-behind does a lot of data process and sometime takes 3-4 minutes to finish. Does anyone have ideas how to do it?
Any help would be very appreciated!
Thanks!!
|
|
|
|
|
You need to use AJAX to do that.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks for responses! Do you know any examples that I can reference?
|
|
|
|
|
|
Thank you very much! It looks very promising. I will give it try and see if it works.
|
|
|
|
|
I can upload file from my local machine using the ,FTPClient, to the FTP site,
but when once the application is on the web server no file shows on the FTP site.
It does not even try to upload...
|
|
|
|
|
Guess you need to ask Richard Howard how to use his library then.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
If it has logging features, have you enabled them so as to troubleshoot and narrow down on what is breaking and where is the bottleneck being encountered?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Can anyone tell me if it is possible to have a drop down menu that contains the selection of time.for example from 12:01 AM to 11:59 PM?
thanks for your answer..
|
|
|
|
|
|
|
Well, thanks. But if it is possible to include it inside "response.write" object?..How?
Thanks..
|
|
|
|
|
Hi please can any one help out
I have file upload issue here.. whenever a page postback it lost it state, even i have set it attribute EnabledViewState to "True".
i dont figure out what is the problem y it is behaving like that
if any one help me out i shall be thanxful
|
|
|
|