Click here to Skip to main content
15,916,842 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionSearch Database Pin
The ANZAC7-Dec-06 18:05
The ANZAC7-Dec-06 18:05 
AnswerRe: Search Database Pin
Christian Graus7-Dec-06 18:40
protectorChristian Graus7-Dec-06 18:40 
GeneralRe: Search Database Pin
The ANZAC7-Dec-06 18:44
The ANZAC7-Dec-06 18:44 
QuestionSet blank for 1st item combolist in VSFlexGrid Pin
angelagke7-Dec-06 17:05
angelagke7-Dec-06 17:05 
QuestionVB script not workng on Win 2000 Pin
japel7-Dec-06 10:53
japel7-Dec-06 10:53 
QuestionRound to nearest quarter of hour Pin
VK-Cadec7-Dec-06 10:07
VK-Cadec7-Dec-06 10:07 
AnswerRe: Round to nearest quarter of hour Pin
Uber17-Dec-06 15:51
Uber17-Dec-06 15:51 
GeneralRe: Round to nearest quarter of hour Pin
Uber17-Dec-06 16:28
Uber17-Dec-06 16:28 
Here is an example of what I was talking about using the if elseif then statement. This assumes you have two labels on a form named Label2 and Label3.

Private Sub Load_Time()
        'calculates the rounded time
        Dim newtime As DateTime
        Dim min As Integer = Now.Minute
        Label2.Text = Now.ToShortTimeString
        If min >= 0 And min <= 15 Then 'First Quarter
            If min > 7 Then
                'move up
                newtime = New DateTime(Now.Year, Now.Month, Now.Day, Now.Hour, 15, Now.Second)
                Label3.Text = newtime.ToShortTimeString
            Else
                'move down
                newtime = New DateTime(Now.Year, Now.Month, Now.Day, Now.Hour, 0, Now.Second)
                Label3.Text = newtime.ToShortTimeString
            End If
        ElseIf min > 15 And min <= 30 Then 'Second Quarter
            If min > 22 Then
                'move up
                newtime = New DateTime(Now.Year, Now.Month, Now.Day, Now.Hour, 30, Now.Second)
                Label3.Text = newtime.ToShortTimeString
            Else
                'move down
                newtime = New DateTime(Now.Year, Now.Month, Now.Day, Now.Hour, 15, Now.Second)
                Label3.Text = newtime.ToShortTimeString
            End If
        ElseIf min > 30 And min <= 45 Then 'Third Quarter
            If min > 37 Then
                'move up
                newtime = New DateTime(Now.Year, Now.Month, Now.Day, Now.Hour, 45, Now.Second)
                Label3.Text = newtime.ToShortTimeString
            Else
                'move down
                newtime = New DateTime(Now.Year, Now.Month, Now.Day, Now.Hour, 30, Now.Second)
                Label3.Text = newtime.ToShortTimeString
            End If
        ElseIf min > 45 And min <= 59 Then 'Fourth Quarter
            If min > 52 Then
                'move up
                newtime = New DateTime(Now.Year, Now.Month, Now.Day, Now.Hour + 1, 0, 0)
                Label3.Text = newtime.ToShortTimeString
            Else
                'move down
                newtime = New DateTime(Now.Year, Now.Month, Now.Day, Now.Hour, 45, Now.Second)
                Label3.Text = newtime.ToShortTimeString
            End If

        End If
        newtime = Nothing
        min = Nothing
    End Sub


Recreating the wheel is the best way to appreciate what the previous coders have gone through to get you where you are now.

QuestionC++ and VB.NET Pin
Kornfeld Eliyahu Peter7-Dec-06 9:39
professionalKornfeld Eliyahu Peter7-Dec-06 9:39 
QuestionHow to get multiple key states simultaneously Pin
Gregbob7-Dec-06 7:41
Gregbob7-Dec-06 7:41 
AnswerRe: How to get multiple key states simultaneously Pin
Christian Graus7-Dec-06 8:11
protectorChristian Graus7-Dec-06 8:11 
QuestionHow to control tab size Pin
adairjk7-Dec-06 5:58
adairjk7-Dec-06 5:58 
Questionmdi application error Pin
kharkov927-Dec-06 5:15
kharkov927-Dec-06 5:15 
AnswerRe: mdi application error Pin
minhnguyen089-Dec-06 1:04
minhnguyen089-Dec-06 1:04 
GeneralRe: mdi application error Pin
kharkov9211-Dec-06 4:07
kharkov9211-Dec-06 4:07 
QuestionCallbackOnCollectedDelegate with keeyboard Hook Pin
tessers7-Dec-06 1:31
tessers7-Dec-06 1:31 
Questionsharing of a translucent form using netmeeting Pin
rumadash7-Dec-06 0:14
rumadash7-Dec-06 0:14 
AnswerRe: sharing of a translucent form using netmeeting Pin
Dave Kreskowiak7-Dec-06 15:04
mveDave Kreskowiak7-Dec-06 15:04 
GeneralRe: sharing of a translucent form using netmeeting Pin
rumadash7-Dec-06 16:00
rumadash7-Dec-06 16:00 
GeneralRe: sharing of a translucent form using netmeeting Pin
Dave Kreskowiak7-Dec-06 18:00
mveDave Kreskowiak7-Dec-06 18:00 
Questionhow to download binary file from SQL SERVER to VB.NET Pin
Syed Ali Raza6-Dec-06 22:27
Syed Ali Raza6-Dec-06 22:27 
AnswerRe: how to download binary file from SQL SERVER to VB.NET Pin
Alessandro7-Dec-06 1:57
Alessandro7-Dec-06 1:57 
QuestionPanels Pin
punam306-Dec-06 20:05
punam306-Dec-06 20:05 
AnswerRe: Panels Pin
Christian Graus6-Dec-06 20:30
protectorChristian Graus6-Dec-06 20:30 
AnswerRe: Panels Pin
obarahmeh7-Dec-06 4:41
obarahmeh7-Dec-06 4:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.