Question Need help to track time

karthik82.vk

Member
Joined
Oct 31, 2012
Messages
8
Programming Experience
Beginner
Hi

I am developing a time tracking application for my project and I need some help in that.

I have a status combo which has the values like In Progress, Open, Closed

There are two text boxes namely start date and completed date.

When the user selects the In Progress Value in the combo box, then the current date with time needs to be populated in the start date text box. When the user selects the value closed in the same combo box, then the date and time at which the user selected the closed value in the combo box needs to be populated in the textbox named as completed date.

Untitled.png

I have no idea of doing this, since I am very new to programming in vb.net.

Can someone hep me in this with sample code.

This will be highly helpful for me. Thanks in advance

Regards,
Karthik Venkatraman
 
You should be able to handle the ComboBox.SelectedIndexChanged event for the status combobox. In this method, check the selected value and if it is In Progress or Closed, then you can use
VB.NET:
DateTime.Now().ToString(pattern)
to get the current timestamp and set that as the Text property of the respective TextBox. The parameter 'pattern' passed into ToString gives the pattern or order of the date/time parts, such as month/day/year or day/month/year, etc. You can read about the different pattern options at Standard Date and Time Format Strings.

Note, you may want to consider how you handle the case where the user chooses InProgress from the status combobox and there is already a start date. In this case you may not want to reset the start date.

Give this a try and if you get stuck along the way, post your code and we can help you out. Good luck!
 
You should be able to handle the ComboBox.SelectedIndexChanged event for the status combobox. In this method, check the selected value and if it is In Progress or Closed, then you can use
VB.NET:
DateTime.Now().ToString(pattern)
to get the current timestamp and set that as the Text property of the respective TextBox. The parameter 'pattern' passed into ToString gives the pattern or order of the date/time parts, such as month/day/year or day/month/year, etc. You can read about the different pattern options at Standard Date and Time Format Strings.

Note, you may want to consider how you handle the case where the user chooses InProgress from the status combobox and there is already a start date. In this case you may not want to reset the start date.

Give this a try and if you get stuck along the way, post your code and we can help you out. Good luck!

Hi,

Thanks for helping me in this...

I have figured out the solutions....
 
Back
Top