• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Formating and displaying in label

msqueen082

Junior Member
Hi
I am trying to format a time display it in a label.. I am challenging visual basic this quarter in school and it is kicking my butt :\
Can you please help me out in the following code..It is for a homework assignment

Code:
[SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]'============================FormatTime=============================
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]'given - an integer representing a valid military 
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' task - convert the military time into standard hh:mm am/pm
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' return - a string containing the time in hh:mm am/pm format
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] sTime [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]String
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] eTime [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]String
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
sTime = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]integer[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].parse(txtStart.text)
eTime = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]integer[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].parse(txtEnd.text)
lblStart.text = format ([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"h"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]":"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"mm"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & tt[/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]")
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]lblStart.text = Format([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"h"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]":"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"mm"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]":"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"tt"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2][/SIZE] 
[SIZE=2]
[/SIZE]
 
Back
Top