473,399 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Creating a TV Programs timetable with vb6

228 100+
Hi,

I am creating a program for television shows/programs. everything works fine...time taken by a particular program, total time wasted in a day, week and used in day, week, specific hours etc.

i am having problem during data entry. after the user clicks "Add Program", it is added to a listview. my problem now is this:

say the user enters starting time of a program to be 8:00, and next program at 9:00...after all are added, he may enter 7:30 or 7:45. i need this hour to be added before 8:00 in the listview. so far my codes haven't been able to search for the right "position" to place it in the listview.

any idea please?
Mar 4 '11 #1
4 2263
Rabbit
12,516 Expert Mod 8TB
It would help if you posted the code that you tried.
Mar 4 '11 #2
samvb
228 100+
Expand|Select|Wrap|Line Numbers
  1. Private Sub InsertProgramTime(ByVal pgt As String)
  2.  
  3. Dim lp As Integer
  4. Dim lpup As Integer
  5. Dim lpdown As Integer
  6. Dim cnt As Integer
  7. Dim currenttime As String
  8. Dim beforetime As String
  9. Dim aftertime As String
  10. Dim timedc As Double
  11. cnt = lvtt.ListItems.Count
  12. If cnt = 0 Then
  13. programindex = 1
  14. Exit Sub
  15. End If
  16.  
  17. If pgt = "__:__" Then
  18. programindex = cnt + 1
  19. Exit Sub
  20. End If
  21.  
  22. For lp = 1 To cnt
  23. lpup = lp + 1
  24. lpdown = lp - 1
  25.  If lpup > cnt Then lpup = cnt
  26.  If lpdown <= 0 Then lpdown = 1
  27.  currenttime = lvtt.ListItems(lp).ListSubItems(1).Text 'current row
  28.  beforetime = lvtt.ListItems(lpdown).ListSubItems(1).Text 'time before current row
  29.  aftertime = lvtt.ListItems(lvup).ListSubItems(1).Text 'time after current row
  30. timedc = DateDiff("s", currenttime, pgt)
  31. If timedc < 0 Then 'previous to that row
  32. programindex = lp
  33. Exit Sub
  34. Exit For
  35. End If
  36.  
  37.  
  38.  
  39.  
  40. Next lp
  41.  
  42. programindex = cnt + 1
  43.  
  44.  
  45.  
  46. End Sub
  47.  
  48.  
is the code i tried. it accepts "8:00" format argument (24-hours).
Mar 5 '11 #3
samvb
228 100+
Expand|Select|Wrap|Line Numbers
  1. Private Sub InsertProgramTime(ByVal pgt As String)
  2.  
  3. Dim lp As Integer
  4. Dim lpup As Integer
  5. Dim lpdown As Integer
  6. Dim cnt As Integer
  7. Dim currenttime As String
  8. Dim beforetime As String
  9. Dim aftertime As String
  10. Dim timedc As Double
  11. cnt = lvtt.ListItems.Count
  12. If cnt = 0 Then
  13. programindex = 1
  14. Exit Sub
  15. End If
  16.  
  17. If pgt = "__:__" Then
  18. programindex = cnt + 1
  19. Exit Sub
  20. End If
  21.  
  22. For lp = 1 To cnt
  23. lpup = lp + 1
  24. lpdown = lp - 1
  25.  If lpup > cnt Then lpup = cnt
  26.  If lpdown <= 0 Then lpdown = 1
  27.  currenttime = lvtt.ListItems(lp).ListSubItems(1).Text 'current row
  28.  beforetime = lvtt.ListItems(lpdown).ListSubItems(1).Text 'time before current row
  29.  aftertime = lvtt.ListItems(lvup).ListSubItems(1).Text 'time after current row
  30. timedc = DateDiff("s", currenttime, pgt)
  31. If timedc < 0 Then 'previous to that row
  32. programindex = lp
  33. Exit Sub
  34. Exit For
  35. End If
  36.  
  37.  
  38.  
  39.  
  40. Next lp
  41.  
  42. programindex = cnt + 1
  43.  
  44.  
  45.  
  46. End Sub
  47.  
  48.  
is the code i tried. it accepts "8:00" format argument (24-hours).
Mar 5 '11 #4
samvb
228 100+
Oh, I finally got the solution:

[/code]
Private Sub InsertProgramTime(ByVal pgt As String)
Dim looper3 As Integer
Dim cnt As Integer
cnt = lvtt.ListItems.Count
If cnt = 0 Then
programposition = 1
Exit Sub
End If

For looper3 = 1 To lvtt.ListItems.Count

If DateDiff("s", lvtt.ListItems(looper3).ListSubItems(1).Text, pgt) < 0 Then

programposition = looper3
Exit Sub
Exit For

End If
Next looper3
programposition = lvtt.ListItems.Count + 1


End Sub

[/code]
Mar 5 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Chris Rodgerson | last post by:
Hi all, I have a page with the date being passed in(calendar_week.php?date=6-4-2005), but what i want to do is display a timetable for the week that date falls on, from 8am-8pm in half-hour...
4
by: Heber | last post by:
I looking for a source (book, on line tutorial, etc.) that will introduce me to writing programs that control my computer. For example, a program that enters bids on eBay automatically. Or a...
0
by: richard | last post by:
The Open Source Developers' Conference is on next week (Dec 1 - 3) in Melbourne (Australia) and the conference timetable is now available: <http://www.osdc.com.au/news/timetable.html> As you can...
6
by: MA | last post by:
Hi all! Im going to develop a timetable with c# and asp.net. Does anyone knows of any good site where i can find information? I have googled for a while, but cant find anything. /Marre
9
by: crescent_au | last post by:
Hi everybody, I want to create dynamic breadcrumbs for a site I am developing. I just want to get some views about the algorithm of breadcrumbs. The way I look at it is the concept of parent/...
0
by: Paul Boddie | last post by:
EuroPython is the European Python and Zope Conference, taking place this year in Vilnius, Lithuania from Monday 9th July to Wednesday 11th July. The last day of EuroPython's early registration...
17
by: chaos | last post by:
HELLO !!! i doing timetable system using php. i now stuck in part whereby showing the change between Original TimeTable and Proposed TimeTable in chart so that the user will know the change he...
26
by: hiyamwah | last post by:
Hi,This is my problem which my work want me to solve: This system is intended to provide the school timetabler with information to support his/her timetabling activities. Please note it is not...
0
by: smoothkriminal1 | last post by:
the question is u read timetable of 40 students from file n den find da slot where all fourty students dnt hve clash...if any.... may b i ll be able to make clash logic but i m even just nt...
0
by: str1ker | last post by:
Hi, I've been working with C# for quite a while now, and I'd like to start creating programs which aren't the usual old regular Windows controls. I'd like to have controls which are graphically...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.