Results 1 to 8 of 8

Thread: Listbox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Posts
    87

    Listbox

    Hi everyone!

    I am making a twisted version of who wants to be a millionaire, for school, but you know how I've got to display what you are up to e.g "$32,000". I thought about using a listbox but this is very boring .

    Any other ways to do this? thanks

    just ideas are good
    "Most cars on our roads have only one occupant, usually the driver."
    - Carol Malia, BBC Anchorwoman

    "I do not like this word "bomb." It is not a bomb. It is a device that is exploding."
    - Jacques le Blanc, French ambassador on nuclear weapons

    "Solutions are not the answer."
    - Richard Nixon, former U.S. President

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Listbox

    A control array of label or textbox might be a good alternative...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Posts
    87

    Re: Listbox

    any1 else?
    "Most cars on our roads have only one occupant, usually the driver."
    - Carol Malia, BBC Anchorwoman

    "I do not like this word "bomb." It is not a bomb. It is a device that is exploding."
    - Jacques le Blanc, French ambassador on nuclear weapons

    "Solutions are not the answer."
    - Richard Nixon, former U.S. President

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

    Re: Listbox

    Actually dee-u's suggestion of labels is not a bad idea.

    You could have a label for each level, all of which have their visible property set to false when the program started.

    At each level, the corresponding label would be made visible, and at each level you could set the font size to one bigger than the previous label, and change the forecolor for each until the top has been achieved.

  5. #5
    New Member wspguy's Avatar
    Join Date
    Sep 2005
    Location
    South Carolina
    Posts
    13

    Re: Listbox

    I wouldn't set the visible property to false, you'd loose the affect of "levels". Just set the all the fonts and sizes in an incrementing fashion and then make the current level BOLD.

  6. #6
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: Listbox

    or use a Textboxes, a Shape and a Timer and change font color and the background colors for the active level giving you a nice effect (See Image):


    VB Code:
    1. Option Explicit
    2.  
    3. ' At least two Textboxes arranged in a Control Array
    4. ' Add One ComboBox, One Timer and One Shape
    5. ' Use default names for all controls
    6.  
    7. Dim blnBackgroundMode As Boolean
    8. Dim lngTextBoxIndex As Long
    9. Dim a As Long
    10.  
    11. Private Sub Combo1_Click()
    12.  
    13. lngTextBoxIndex = Combo1.Text
    14.    
    15. With Text1
    16.     For a = .LBound To .UBound
    17.         With .Item(a)
    18.             .BackColor = vbWhite
    19.             .ForeColor = vbBlack
    20.             .FontBold = False
    21.             blnBackgroundMode = True
    22.         End With
    23.     Next a
    24. End With
    25.  
    26.  
    27. End Sub
    28.  
    29. Private Sub Form_Load()
    30.    
    31.     With Text1
    32.         For a = .LBound To .UBound
    33.             With .Item(a)
    34.                 .Text = "Level " & a + 1
    35.                 .Alignment = 2
    36.                 .Appearance = 0
    37.                 .FontBold = False
    38.                 Combo1.AddItem a
    39.             End With
    40.         Next a
    41.        
    42.         Combo1.ListIndex = 0
    43.     End With
    44.  
    45.     With Timer1
    46.         .Interval = 250
    47.         .Enabled = True
    48.     End With
    49.    
    50. End Sub
    51.  
    52. Private Sub Timer1_Timer()
    53.  
    54.     With Text1.Item(lngTextBoxIndex)
    55.         Shape1.Move .Left - 50, .Top - 50, .Width + 100, .Height + 100
    56.         Shape1.Visible = True
    57.  
    58.         If blnBackgroundMode Then
    59.             .BackColor = vbWhite
    60.             .ForeColor = vbBlack
    61.             Shape1.BorderColor = vbRed
    62.             blnBackgroundMode = False
    63.         Else
    64.             .BackColor = vbRed
    65.             .ForeColor = vbWhite
    66.             Shape1.BorderColor = vbBlack
    67.             blnBackgroundMode = True
    68.         End If
    69.        
    70.        .FontBold = Not (.FontBold)
    71.     End With
    72. End Sub
    Attached Images Attached Images  
    Last edited by Mark Gambo; Sep 14th, 2005 at 02:50 PM.
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  7. #7
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: Listbox

    Or if you want to keep a similar design, the listview control gives you more options for font alterations for each item than a listbox.


    Has someone helped you? Then you can Rate their helpful post.

  8. #8
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Listbox

    Or a flexgrid/mshflexgrid...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

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