I am making a cyber cafe system where user have to login their own account and i want to use a field "REMAININGTIME" which determines how much time left they have in their own account database. and it will display in the form as lbl.

form will be look like:

TIME REMAINING: 4 hours 2 minutes

until it will became 0 hours and 0 minutes.

QUestion:
what will the "Data Type" of my Field "REMAININGTIME" Is it should be text or data/time?
If i pass the records to a label how can I get it to countdown until zero min and hour?
I already have one timer and it is use for a live clock. Do i have to make another one?

Here is an example of a way to create a countdown timer. You should be able to use your existing timer.

Public Class Form1
    Dim endTime As Date

    Private Sub Form1_Load(ByVal sender As  System.Object, ByVal e As System.EventArgs) Handles  MyBase.Load
        Dim span As New TimeSpan(0, 300, 0)
        endTime = Now() + span
        Timer1.Enabled = True
        Timer1.Interval = 60000
    End Sub

    Private Sub Timer1_Tick(ByVal sender As  System.Object, ByVal e As System.EventArgs) Handles  Timer1.Tick
        Dim remaining As TimeSpan = endTime.Subtract(Now)
        lblRemaining.Text = "Remaining Time: " & remaining.Hours & " hours and " & remaining.Minutes & " minutes"
    End Sub
End Class

I missed a part of your question - I would store the remaining time as an integer for the minutes remaining, which to could pass to the above code.

        Dim rTime As Integer
        rTime = 300'or the value from your database.
        Dim span As New TimeSpan(0, rTime, 0)

I hope that helps!
- Ken

i have database which had a field "TIMELEFT" and set as Text
eg. 15:3

should I change the value?

You don't have to change it. You just need to pass the values the right part of Timespan: Dim span As New TimeSpan(rHours, rMin, rseconds) or something like that. So you could split your 15:3 and assign 15 to rHours, 3 to rMin.
I tried it like this and it works:

Public Class Form1
    Dim endTime As Date

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim rHours As String
        Dim rmin As String
        rHours = 15 
        rmin = 3
        Dim span As New TimeSpan(rHours, rmin, 0)'  Although you are passing a string, it will be seen as an integer
        endTime = Now() + span
        Timer1.Enabled = True
        Timer1.Interval = 15000
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim remaining As TimeSpan = endTime.Subtract(Now)
        lblRemaining.Text = "Remaining Time: " & remaining.Hours & " hours and " & remaining.Minutes & " minutes"
    End Sub
End Class
This article has been dead for over six months. Start a new discussion instead.