Jump to content

date and time present

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
11 replies to this topic

#1
Siten0308

Siten0308

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 302 posts
Hello,

I am making a bank program right now, i just have a few questions, this is regarding to the features of C#, first, i know to make a date and time and how to display which i put datetime date; and i made a list box to show either depost, withdraw, how much, and the date and time in the list box, my first question is how do i get it to be present time, every time i deposit or withdraw it shows 1/1/0001, i want it to show present, the second question is i made an additonal form which would be the transfer button, my question is, when you call up to form.show for say... and you dont want the user to go back to the other form and hit the button again, making it display two of the same forms, is there a way i can have the user only stay at the transfer form and not go back until he hits close on the transfer form? (hope that made sense) the last question is how do i embed an icon on the form? when i mean icon i mean the top left hand corner of the program? I probably will have additional questions but one last thing, is there anything i can do with my bank program like nice little features add on to it that you have done in the past with your projects? it would be helpful for me to learn. Thank you in advance.

#2
Siten0308

Siten0308

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 302 posts
I have thought of another question pertaining to the bank program, when i try and press the button 1 on my keyboard, i wanted it to also show up on the screen, and not have to click on button 1, how do i do that? (hope i explained that)

#3
gaylo565

gaylo565

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 268 posts
While there are several ways to get the current date I'm only gonna list one:
DateTime dtToday = DateTime.Now;
Make sure you set your variable to the correct time before you print it to a record (before meaning it runs the code first.)
To hide your old form there should me a hide method...try this.Hide() just before you open your new form. The icon should be as easy as modifying a button or label until you come up with what you want the writing a click handler event to the icon. Under the method for the click handler have it call whichever file or function you want your icon to access. It sounds like you have a good solid project going there:) Maybe try adding some card access to accounts. For example; if someone enters a card number (you would use the input from a card reader in real life but not all of us have one of those lying around) and then give them access to their account or other options concerning ordering new cards, reporting cards stolen, and other such things. Good luck and happy coding!

#4
Siten0308

Siten0308

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 302 posts
thanks gaylo again,

I have tried to use the this.hide() however the problem with that is if i use it, and close the program complete, it does not necessary close it out because i tried running it, closing the transfer form to go back to original form, which i just used this.close to close the transfer form and then did form1.show, and when i close the form1, it still things the program is running, which i am assuming the first form1 is still running, does that make sense, is there another way besides hidding the form, maybe making it none accessible if you try to click it just makes a sound and you can only click on the form2 which is the transfer form. does that make sense? and for the card key... that will have to wait, sounds a little advance which i would be happy to learn, but for now the only thing i do have right now is just launching the program, maybe later i will create another project that includes this one, but the user will have to enter username and password, checking on the SQL database/Access database, verifying and allow them to come in and bring up there account checking and savings... or what else can you add to it?

#5
Siten0308

Siten0308

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 302 posts
Hello,

Also i want to add, like banks, they have transaction numbers, how would i go about adding that to the list box, like starting from 1-whatever down the line for every transaction that is done to the account (i happen to call my class account that holds the variable balance, which includes the depost and withdraw method for FYI)?

#6
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts

Siten0308 said:

thanks gaylo again,

I have tried to use the this.hide() however the problem with that is if i use it, and close the program complete, it does not necessary close it out because i tried running it, closing the transfer form to go back to original form, which i just used this.close to close the transfer form and then did form1.show, and when i close the form1, it still things the program is running, which i am assuming the first form1 is still running, does that make sense, is there another way besides hidding the form, maybe making it none accessible if you try to click it just makes a sound and you can only click on the form2 which is the transfer form. does that make sense? and for the card key... that will have to wait, sounds a little advance which i would be happy to learn, but for now the only thing i do have right now is just launching the program, maybe later i will create another project that includes this one, but the user will have to enter username and password, checking on the SQL database/Access database, verifying and allow them to come in and bring up there account checking and savings... or what else can you add to it?
Launch the subform with ShowDialog() instead of Show(). This will make it modal, which is what you want I believe.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#7
Siten0308

Siten0308

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 302 posts
Yup thats it Xav thanks, but now i am wondering about my other questions.

1.when i try and press the button 1 on my keyboard, i wanted it to also show up on the screen, and not have to click on button 1, how do i do that? (hope i explained that)

2.Embed a Icon which Gaylo went over but still need more info on that if anyone can provide it.

3. problem with current time datetime date = new datetime.Now(), it seems to work but for some reason it only stay to the most recent, even after more than 5 minutes of trying it still stays with the first time such as

10/8/2008 2:49pm
then wait 5 minutes and make a deposit, it still says:
10/8/2008 2:49pm
What gives : (

#8
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
You need to use a timer to constantly update the date. The line of code puts the current date into a variable - it's not automatically going to increment itself, you have to do that.

Also, you can send keys to the program or just edit a control's Text property if that's what you want.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#9
Siten0308

Siten0308

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 302 posts
Hello Xav,

thanks for the info, i got the keyboard keys down now, the timer if you can go into more detail on that by incrementing the datetime.now?

and also embed an icon on the top left hand corner of the program, i know VCE or VS 2008 makes it easy for you, but i try that why and nothing but errors comes up such as "argument, picture must be used as an icon" but i the file extension is .ico and the size is 32X32 and tried 21X21 but still error, i am trying to figure out how to embed it using code which might work out better than the VCE/VS tool.

#10
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Did it use to be a normal picture that you just changed the extension of to ".ico"?
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#11
Siten0308

Siten0308

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 302 posts
Hello Xav,

Actually it was, but then i copied the pic, paste it into paint, resized it, and renamed it and save as... i also tried just downloading a .ico icon from a website and tried, still same error message, i know there is a way in the code but how i dont know.

#12
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
The .ico specification can be a little picky. Also, if you're using IE then a favicon might even be downloaded in a different format, due to a bug. Try looking on websites that allow you to download sets of icons, these will almost certainly work.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums