943,754 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 2126
  • VB.NET RSS
You are currently viewing page 1 of this multi-page discussion thread
Sep 13th, 2008
0

Outputting In Listbox....

Expand Post »
how do i output like datetimepicker.text to a listbox...
I tried datetimepicker1.text but it did not work....can someone help me please
my code is like this...

Rpanel.Hide()

Plistbox.Items.Add("Customer Name" & ControlChars.Tab & _
ControlChars.Tab & "Booking Date" & ControlChars.Tab & _
ControlChars.Tab & "Booking Time")

Plistbox.Items.Add(Bcusname.Text & ControlChars.Tab & _
ControlChars.Tab & Bdate.Value & ControlChars.Tab & _
ControlChars.Tab & btime1)
Reputation Points: 10
Solved Threads: 0
Light Poster
gopi17 is offline Offline
39 posts
since Sep 2008
Sep 13th, 2008
0

Re: Outputting In Listbox....

To show date in long mode :
DateTimePicker1.Value.ToLongDateString() Ex : Saturday, September 13, 2008

To show date in Short mode :
DateTimePicker1.Value.ToShortDateString() Ex : 9/13/2008
Last edited by Jx_Man; Sep 13th, 2008 at 2:22 am.
Reputation Points: 1182
Solved Threads: 392
Posting Sensei
Jx_Man is offline Offline
3,138 posts
since Nov 2007
Sep 14th, 2008
0

Re: Outputting In Listbox....

hay,
i hope it will be worked.you concatenate now to others that it will display current day,month and time.
eg., ListBox1.Items.Add(Now)
reply please.,
Reputation Points: 10
Solved Threads: 0
Newbie Poster
silambharasan is offline Offline
17 posts
since Sep 2008
Sep 14th, 2008
0

Re: Outputting In Listbox....

thanks jx..its working....
and yes silam its working too...but now i have another problem...i can display date and time...

now i only wanna display time...i try changing the format but it displays both time and date together....any idea?
Reputation Points: 10
Solved Threads: 0
Light Poster
gopi17 is offline Offline
39 posts
since Sep 2008
Sep 14th, 2008
0

Re: Outputting In Listbox....

>> now i only wanna display time...i try changing the format but it displays both time and date together....any idea?

To Show current date with long format :
FormatDateTime(TimeOfDay, DateFormat.LongTime) Result : 10:40:05 PM

To Show current date with short format :
FormatDateTime(Now,DateFormat.ShortTime) Or
FormatDateTime(TimeOfDay,DateFormat.ShortTime) Result : 22:40

Visit this site, there are tutorial about Format() function.
Last edited by Jx_Man; Sep 14th, 2008 at 12:44 pm.
Reputation Points: 1182
Solved Threads: 392
Posting Sensei
Jx_Man is offline Offline
3,138 posts
since Nov 2007
Sep 14th, 2008
0

Re: Outputting In Listbox....

now i only wanna display time...i try changing the format but it displays both time and date together....any idea?[/QUOTE]

hay,
thats not a problem man i can help u. use the following ,u can obtain separately,
"M/d/yy" 12/19/07
"MM-dd-yy" 12-19-07
hh:mm:ss 11:27:07
hh:mm:ss tt 11:27:07 AM
u can use this inside your format.
eg., TextBox1.Text = Format(Now, "hh:mm:ss")
reply pls.,
Reputation Points: 10
Solved Threads: 0
Newbie Poster
silambharasan is offline Offline
17 posts
since Sep 2008
Sep 16th, 2008
0

Re: Outputting In Listbox....

thanks alot for your help jx and silam....

say guys can u help with system time...

i have a booking time

eg.

i set the booking time at 1.00 Am,then once the booking equals to system time a messagebox appears....

can i do sumthin like this:

btime.text = date.now

??
Reputation Points: 10
Solved Threads: 0
Light Poster
gopi17 is offline Offline
39 posts
since Sep 2008
Sep 16th, 2008
0

Re: Outputting In Listbox....

Using timer to check booking time with system time :
On Timer properties
- Set timer Enable = True
- Set Interval = 1000
vb Syntax (Toggle Plain Text)
  1. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  2. Dim btime As DateTime
  3. btime = FormatDateTime("1:00:00 AM", DateFormat.LongTime)
  4. If FormatDateTime(TimeOfDay, DateFormat.LongTime) = btime Then
  5. MsgBox("Booking Time up")
  6. End If
  7. End Sub
Last edited by Jx_Man; Sep 16th, 2008 at 1:30 am. Reason: Code Tags and some explaination
Reputation Points: 1182
Solved Threads: 392
Posting Sensei
Jx_Man is offline Offline
3,138 posts
since Nov 2007
Sep 19th, 2008
0

Re: Outputting In Listbox....

hey thank for your help jx_man....my project is 50% complete....i need help with this problem too...appretiate your help.

here is my code
vbnet Syntax (Toggle Plain Text)
  1. If tableno = 1 Then
  2. status = "Booked"
  3. Table1.BackColor = Color.Khaki
  4. Spanel.Hide()
  5. Rpanel1.Show()
  6.  
  7. Dim btimeA As DateTime
  8. btimeA = FormatDateTime(btime1.Value, DateFormat.LongTime)
  9. If FormatDateTime(TimeOfDay, DateFormat.LongTime) = btimeA.AddMinutes(20) Then
  10. MsgBox("Booking Time up Mr/Miss " & Bcusname1.Text & " is late,reservation canceled")
  11. Table1.BackColor = Color.PaleGreen
  12. status1 = "Available"

How do set the timer to start 2 hours b4 the booking time?...lets say the booking is at 7, the button will be yellow at 5 only...i try a few ways its not working.....would really appreciate your help...
Last edited by cscgal; Sep 20th, 2008 at 12:23 am. Reason: Added code tags
Reputation Points: 10
Solved Threads: 0
Light Poster
gopi17 is offline Offline
39 posts
since Sep 2008
Sep 20th, 2008
0

Re: Outputting In Listbox....

- using TimeSerial() Function to get 2 hours before booking time.
see this line bTimeUp = TimeSerial(btimeA.Hour - 2, btimeA.Minute, btimeA.Second)
vb.net Syntax (Toggle Plain Text)
  1. Dim bTimeA As DateTime
  2. Dim bTimeUp As DateTime
  3. btimeA = FormatDateTime(btime1.Value, DateFormat.LongTime)
  4. bTimeUp = TimeSerial(btimeA.Hour - 2, btimeA.Minute, btimeA.Second)
  5. If FormatDateTime(TimeOfDay, DateFormat.LongTime) = bTimeUp Then
  6. MsgBox("Booking Time up Mr/Miss " & Bcusname1.Text & " is late,reservation canceled")
  7. Table1.BackColor = Color.PaleGreen
  8. status1 = "Available"
  9. End If

- question for u : btime1 is datetimepicker or not?
if yes then set Format = Time on datepicker properties
Last edited by Jx_Man; Sep 20th, 2008 at 2:07 am.
Reputation Points: 1182
Solved Threads: 392
Posting Sensei
Jx_Man is offline Offline
3,138 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: save to Database
Next Thread in VB.NET Forum Timeline: Generating unique filenames





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC