|
if my date time format is mm/dd/yyyy i.e in xml file and current computer date time format is mm-dd-yyyy can i convert my datetime string to new date time or is it that i have to parse individually year month date hour and minute and then compare
|
|
|
|
|
If you know the input format, you can parse it manually to get the date, month and year. With this, you can construct a DateTime object and convert it to whatever format you please using the ToString() method and its overloads. Alternatively, you could just build the date string you need using the date, month and year that you've extracted.
A word of advice - if you're exchanging data between different apps, the ISO format (yyyy-MM-dd) is the only sane thing to use.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
I tried to reply to your email but had a display name problem and could not.
If you are still having problems send an email to this message giving me a sample of
the code you are having the problem with.
I will be able to look at it and respond to you then.
|
|
|
|
|
Try: DateTime.ParseExact() That takes the date/time as string and the format as string array.
Mohamed Gouda
Egypt
|
|
|
|
|
justintimberlake wrote: how can i convert mm/dd/yyyy hh:mm date format to current computer date format
<br />
string your_string_XML_Date =your_XML_Date.ToString(CultureInfo.CurrentCulture);<br />
string currentDateTime = DateTime.Now.ToString(CultureInfo.CurrentCulture);<br />
<code><br />
<br />
Hope that helped<br />
Nassos <br />
<br />
<div class="ForumSig">GanDad</div>
|
|
|
|
|
Hi,
I'm using the RKLib component for exporting the data to excel for quite some time. It's perfectly working fine for me till this time.
Recently I have used the same in another application which contains a dataset(C# appln.) having less than 5000 rows. The issue here is it is taking 1 hr to write it to excel. The dataset contains 30 columns and majority of them are of string data type. Is there any workaround for this so that it will be reduced to maximum 3 minutes. For this application the no. of rows may increase in future. In such a case, I cannot use this component.
Can anybody please help me in this regard?
Thanks
Meeram395
Meeram395
|
|
|
|
|
Do you mean this[^] RKLib? If so, then the source is there so you could go over it with a fine toothed comb to see if there is anything slowing it down design-wise or if there are any modifications you can make to improve it's speed efficiency.
I haven't used that package before so personally I can't speak to its quality. Usually I recommend using the COM Interop[^] capabilities of MS Office to do Excel reading/writing but I've found that it isn't the best performer when it comes to time either.
It seems that you might have to just face the facts here - you're exporting 15,000 strings to an Excel sheet and that's going to take some time no matter what tools you use to do it.
Look at it this way: it takes about an hour for your app to push that dataset into an Excel file, how long would it take to do it manually? If if your app takes an hour, you're still probably getting some pretty nice time savings
|
|
|
|
|
Just curious what I can't do with Visual C# 2005 Express that I could do with VS.NET? Are VSS & database designer the main differences?
I use Subversion, so VSS integration is not an issue.
I just wonder what the compelling reason to upgrade would be?
"For fifty bucks I'd put my face in their soup and blow." - George Costanza CP article: SmartPager - a Flickr-style pager control with go-to-page popup layer.
|
|
|
|
|
Can't create multiple projects in the same solution.
There's no Threads window when you're debugging.
No Crystal Reports.
No addin support.
... and some stuff like that.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Thanks for the answer. 5 from me.
"For fifty bucks I'd put my face in their soup and blow." - George Costanza CP article: SmartPager - a Flickr-style pager control with go-to-page popup layer.
|
|
|
|
|
Vikram writes - Can't create multiple projects in the same solution
I have solutions in VSE, containing up to 11 projects in VSE. What does he mean by "create multiple projects", mine were created one at a time.
rgds phild
|
|
|
|
|
It's been a couple of months since I used VSE, so I don't remember exactly.
Could you please tell me how you created multiple projects in a solution?
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
left click on Solution item in SolutionExplorer (ie the first item) and select Add Project, Select New or Existing .....
I think you can also do same from File menu, don't have VSE in front of me right now.
Also I think the Express version doesn't have all of the templates that the full version has, nor all of the bits required to build "releasable" products eg I don't think signing is available.
|
|
|
|
|
|
I'm developing a multi-player game in C#. Player A hosts a "game room" and creates a game object. Then players B and C gain remote access to that object over a TCP connection. (Assume everyone knows everyone else's IP address). My issue is that player C's UI needs to be updated when player B calls a function on the remote game object. When the program tries to register player C's handler onto the game object's event, I get an exception telling me that my security settings are too low for deserialization.
(Specifically: Type System.DelegateSerializationHolder and the types derived from it (such as System.DelegateSerializationHolder) are not permitted to be deserialized at this security level.)
The message suggests using security certificates to get around all this, but I don't know how this is done. Can someone instruct me on how to get this working? I would really rather not have the host player have to gain remote access to each other play so it can call some "updateUI" function on each player.
|
|
|
|
|
Hi there! I'm an amateur programmer doing a "for fun" project, and am looking for some helpful advice. I'm trying to make a terminal emulator that can emulate ANSI (ANSI X3.64, aka pretty colors in a telnet session) for the purpose of connecting to old BBS software and playing the games of my youth. I already have the Telnet part nailed thanks to a fine article from this site, but the ANSI emulation is starting to look pretty daunting.
My question: Is the best way to do this to use the TextBox component? Changing text color is no problem, but ANSI has escape sequences to move the cursor around, and most BBS software uses them heavily. For instance, if I encountered an ANSI sequence that means "move the cursor to row 3, col 10, and print the letter A", I'm not sure what the "right" way to do that in a TextBox would be. The best way I can think of is to pre-populate the TextBox.Text string with enough spaces to fill the screen, and then replace the character at position ((number of columns on the screen * 2) + 10) of the string, but that seems hideously inelegant.
Alternately, is there some other component that would be better suited to this? Should I be leveraging existing ANSI support from somewhere, like ANSI.SYS? Any suggestions are welcome, and thanks in advance.
|
|
|
|
|
Hi,
I tend to use TextBox only for single-line or few-lines stuff.
For an editor or a terminal, I would choose between:
- a Panel, i.e. doing it all myself (data structures, paint handler, etc)
- a ListBox
although I admit you can do it with a TextBox too.
the advantages of ListBox are:
- treats lines as separate objects; this is both easy to use and fast (TextBox concatenates
all text lines to a single string)
- knows how to draw a line of text (but also supports user drawing)
- scrolling could mean: remove topmost text line, add new text line at bottom (so make
sure to never hold more than 25 lines)
- emulating terminal with buffer larger than display height is free: use vertical scrollbar
(keep the LB 25 lines high), and let it scroll when more lines have been added to it
Hope this helps.
|
|
|
|
|
Thanks Luc, I had not considered a ListBox because I thought it would be unsuitable for my purpose; For one thing, the user wouldn't be able to highlight and copy text that spans multiple rows. For another, I can't control the color of the LB items letter by letter, can I? And for a third, I didn't know LB's could add new items to the bottom, as opposed to the top. (And I still can't figure out how to do that) I guess I will have to go back to the drawing board on this one, or pick a simpler project, as starting with a panel and doing it all myself is probably beyond me at this point. Thanks anyway though.
|
|
|
|
|
Hi,
1. yes selection across multiple lines would be a problem.
2. by default lines get drawn in single font, size, color as in a regular TextBox
(as opposed to a RichTextBox). Character coloring (or anything else fancy)
would require you choose the OwnerDrawn model, in which you provide the code
to paint each line yourself (a simple Graphics.DrawString would again
offer the default behavior).
3. yes, maipulating lines is easy through the ListBox.Items property, which
lets you add, remove, insert, and modify lines, either through methods
or by using an indexor.
Conclusion: if you need all the fancy coloring and free selection, then ListBox
is not an option, and you must either go for RichTextBox (and live with
degrading performance in case the text gets really large, which is unlikely in
your app), or go for a Panel and do it all yourself.
BTW Come to think of it, I am not sure you can do all required selection stuff
with what a (Rich)TextBox offers; I am not sure how far an ANSI terminal would go,
IIRC a VT-220 could have multiple selections, some steady some blinking...
Cheers.
|
|
|
|
|
Thanks for the advice Luc, it sounds like I just need to do the terminal from the ground up, or change the design completely. I'm thinking perhaps I will make a localhost proxy for a telnet session to go through (using Windows telnet, with its built-in ANSI support). That way I can capture text from the session and use it to populate a db, and then make a companion app that does things with the data in the db. Once again, thanks for helping a beginner, I'm glad I didn't spend too much time trying to do this the wrong way.
|
|
|
|
|
You're welcome.
|
|
|
|
|
Sorry to keep dragging this out, but a thought occurred to me: would it be possible to just spawn a command prompt inside a Windows form and run the standard telnet.exe through it? As long as I could send input to it and read what it outputs, that would get me where I need to go, since cmd includes ANSI support via ANSI.sys. I know I can spawn .bat's and .exe's as external processes, but I don't know if it's possible to do something like that within a form and interact with it. Thanks again in advance.
|
|
|
|
|
Hi,
in general this is possible. You need the Process class to do it, and you should:
- either redirect Input, Output and Error streams (and create 3 separate threads to
handle them) but that would not solve your problem, since then you have to show
it again,
- or adopt its Window into your app; IIRC I read a CodeProject article
on that but I have forgotten the details on how to do it. Sorry.
|
|
|
|
|
Hi all,
Does anyone know how you can get an event for when the user clicks on a listbox's verticle scrollbar?, i used a myListBox.Click event, but that only works when I click inside the listbox, not on the scrollbar.
I've been experimenting with overriding the WndProc() method but cant seem to achieve what i want.
Any idea would be greatly appreciated.
Regards,
Mark.
|
|
|
|
|
Hi,
I dont think there is any event related to scrolling.
What would you want to do with a scroll event ?
maybe you could use the Paint event and check whether TopIndex has changed.
|
|
|
|