Results 1 to 7 of 7

Thread: How to have two combo at same form

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2005
    Posts
    61

    How to have two combo at same form

    Hello,

    I am just learning VB6 and i am just wondering if can make a combo list like
    the one has a month and the other would contain the day, i already made the combo for month but i cant make another one for day combo, i know this is a simple question for you guys.,

    and one thing i adopt this system a old one and my but boss ask me if i can modify it so it would look like presentable, how can i open the exe file in VB6.

    hoping for your responce

    thanks and more power


    |_______| |_________| e.g.
    for month and for day
    naz

  2. #2
    Frenzied Member d3gerald's Avatar
    Join Date
    Jan 2006
    Posts
    1,348

    Re: How to have two combo at same form

    for the combo question, i suggest u use dtpicker, it allows you not only to select the date but a specific date itself including the month, day and the year.

    about opening an exe file, you shouldn't do that and theres no way you can do that. its one of the most dangerous crimes in the cyber world and we call that cracking.
    On error goto Trap

    Trap:
    in case of emergency, drop the case...

    ****************************************
    If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option.
    if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar

  3. #3
    Fanatic Member lerroux's Avatar
    Join Date
    Nov 2005
    Location
    Welcome to the darkside... we have cookies
    Posts
    646

    Re: How to have two combo at same form

    i dont think there is any crime if you just open the exe file... try to use
    VB Code:
    1. shell"app.exe"
    for the combo, if it involves date, then i suggest you try DTPICKER
    WARNING: Excessive coding is dangerous to your health... if symptoms persist insult your doctor...

  4. #4
    Fanatic Member lerroux's Avatar
    Join Date
    Nov 2005
    Location
    Welcome to the darkside... we have cookies
    Posts
    646

    Re: How to have two combo at same form

    Quote Originally Posted by nazario
    and one thing i adopt this system a old one and my but boss ask me if i can modify it so it would look like presentable,
    now, you can't modify it anymore unless you have the source for the exe... the vb project file...(*.prj)

    you'll have to make a new one...
    WARNING: Excessive coding is dangerous to your health... if symptoms persist insult your doctor...

  5. #5

    Thread Starter
    Member
    Join Date
    Aug 2005
    Posts
    61

    Re: How to have two combo at same form

    thanks for that quick reply

    Ok i will try it and work aroud it if i can got it right, thanks for the head start D3gerald,lerroux. by the way this project is for our counter part municipality because they are having trouble typing document specially marriage contract in type writer, so its like data entry hmm i guess so. lol

    and for that exe file im gonna try it also , and noted guys

    naz

  6. #6
    Fanatic Member lerroux's Avatar
    Join Date
    Nov 2005
    Location
    Welcome to the darkside... we have cookies
    Posts
    646

    Re: How to have two combo at same form

    glad to be of help!
    WARNING: Excessive coding is dangerous to your health... if symptoms persist insult your doctor...

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to have two combo at same form

    For those of you who might not want to use the DTPicker, here is a little ditty I just whipped up that will place the days of the month in one combo box based on the selection of a month from another combo box.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Function GetMonthNumber(pstrMonthName As String) As Integer
    4. Dim i As Long
    5. For i = 1 To 12
    6.   If pstrMonthName = MonthName(i) Then
    7.      GetMonthNumber = i
    8.      Exit For
    9.   End If
    10. Next
    11. End Function
    12.  
    13. Private Sub cboMonth_Click()
    14. Dim intMonth As Integer
    15. Dim lngYear As Long
    16. Dim intDay As Integer
    17. Dim i As Integer
    18. Dim intNumOfDays As Integer
    19. lngYear = Year(Now)
    20. intDay = 1
    21. intMonth = GetMonthNumber(cboMonth.List(cboMonth.ListIndex))
    22. Select Case intMonth
    23.     Case 1, 3, 5, 7, 8, 10, 12
    24.     intNumOfDays = 31
    25.     Case 4, 6, 9, 11
    26.     intNumOfDays = 30
    27.     Case 2
    28.     intNumOfDays = 28
    29. End Select
    30. cboDays.Clear
    31. For i = 1 To intNumOfDays
    32.    cboDays.AddItem intMonth & "/" & i & "/" & lngYear
    33.    intDay = intDay + 1
    34. Next
    35.  
    36. End Sub
    37.  
    38. Private Sub Form_Load()
    39. Dim i As Long
    40. For i = 1 To 12
    41.     cboMonth.AddItem MonthName(i)
    42. Next
    43. End Sub
    This of course, does not take into account Leap Years in which there are 29 days in Februray. However, determining what year is a leap year is pretty easy and I leave that to you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width