6 Replies - 2987 Views - Last Post: 23 November 2011 - 06:00 AM Rate Topic: -----

#1 Raaj71  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 58
  • Joined: 21-October 11

VB6 - Displaying Information (Running Text)

Posted 19 November 2011 - 06:38 AM

Hi Everyone !

I just wanted some information to be displayed in some box (Outline Box, yet dont know what object i should use Label or Text Box for this) which should be Running slowly controlled by timer from right to left just as it happens on Information Boards at Railway Stations or Airports.

I want to use this technique for displaying all the orders in processing reading details from database.

e.g.

Order No. 9190 is finished and ready for delivery. Order No. 9191 is in printing. Order No. 9192 is delivered and outstanding balance is Rs. 5,000.00

I want this information to be keep on moving till my program is running.

How can i accomplish this ?

Regards

Is This A Good Question/Topic? 0
  • +

Replies To: VB6 - Displaying Information (Running Text)

#2 Neku  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 268
  • Joined: 21-May 09

Re: VB6 - Displaying Information (Running Text)

Posted 19 November 2011 - 07:47 AM

you could use labelbox for showing the text in nice way and with timer change its position on the form.
the timer's interval effect how fast the label move
Was This Post Helpful? 0
  • +
  • -

#3 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: VB6 - Displaying Information (Running Text)

Posted 21 November 2011 - 11:52 AM

Just use the Mid function to take a substring of your string. Store the current offset of the string in a static variable in the timer event. Each time the timer event runs, increment the variable until you have reached the end. You'll need to work out the logic for looping the string around to the beginning, but that gives you the basic idea.
Was This Post Helpful? 0
  • +
  • -

#4 Raaj71  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 58
  • Joined: 21-October 11

Re: VB6 - Displaying Information (Running Text)

Posted 22 November 2011 - 08:23 PM

Thanks all for the suggestions. Its solved.

I have another question this time. Its simple but am just not able to do it.

I have a Combo box and List box in which I am loading names (just trying both for practice) from access database. Its working fine i.e. its loading vales from database successfully but it shows empty combo box when program runs and I have to click on combo box to open the drop down list and see the names. What I want is, when it loads the values from the database, it should not display combo box / list box empty rather it should display the first entry to be displayed without clicking on it.

Regards
Was This Post Helpful? 0
  • +
  • -

#5 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,780
  • Joined: 26-March 09

Re: VB6 - Displaying Information (Running Text)

Posted 23 November 2011 - 01:05 AM

Couple of points.

1. Well done on solving your problem, but please can you post your solution for benefit of others that may have the same problem...that's what the forum is all about.

2. Please can you post new questions in a separate thread. It avoids confusion in threads and is more likely to get you an answer.
Was This Post Helpful? 0
  • +
  • -

#6 Raaj71  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 58
  • Joined: 21-October 11

Re: VB6 - Displaying Information (Running Text)

Posted 23 November 2011 - 03:06 AM

View Postmaj3091, on 23 November 2011 - 01:35 PM, said:

Couple of points.

1. Well done on solving your problem, but please can you post your solution for benefit of others that may have the same problem...that's what the forum is all about.

2. Please can you post new questions in a separate thread. It avoids confusion in threads and is more likely to get you an answer.



Yup Sure maj3091. Am posting the solution here under.

I would definitely post new question in separate thread from now on.


Code for Scrolling Text in Label

'Scrolling Text
' Placed a Label and Timer on the form.

Option Explicit
    '----------------------------- Variable Declaration for Scrolloing Text Label -- lblInfo
    Dim s As Integer
    Dim dta As String

Private Sub Form_Load()
    '---------------------------------------------------------------------------------------------------------------
    lblLabel1.Caption = ""
    Timer1.Enabled = True
    Timer1.Interval = 150
    lblLabel1.Width = 3750
    lblLabel1.Font = "Palatino Linotype Bold"
    lblLabel1.Font.Size = 13
    lblLabel1.ForeColor = vbRed
    '---------------------------------------------------------------------------------------------------------------
End Sub

Private Sub Timer1_Timer()
    dta = "Please Select an Existing Party or Create New Party before proceeding to Order Booking..." ' & Space$(5)
    s = s + 1
    lblLabel1.Caption = Mid(dta, 1, s)
    'If Len(lblLabel1.Caption) >= 42 Then lblLabel1.Caption = Right(lblLabel1.Caption, 41)
    If Len(lblLabel1.Caption) >= 36 Then lblLabel1.Caption = Right(lblLabel1.Caption, 33)
    If s = Len(dta) Then
        lblLabel1.Caption = ""
        s = 0
    End If
End Sub




To automatically load first item in Combo Box at form load

Private Sub Form_Load()
    cboJobList.AddItem ("Visiting Cards")
    cboJobList.AddItem ("Wedding Cards")
    cboJobList.AddItem ("Invitation Cards")
    cboJobList.AddItem ("Letter Pads")
    cboJobList.AddItem ("Calenders")
    cboJobList.AddItem ("Envelops Printing")
    cboJobList.AddItem ("Stickers")
    cboJobList.AddItem ("-------------------")
    cboJobList.AddItem ("Bill/Invoice Books")
    cboJobList.AddItem ("Receipt Books")
    cboJobList.AddItem ("Challan Books")
    cboJobList.AddItem ("Quotation Books")
    cboJobList.AddItem ("Coupon Books")

    [b]cboJobList.ListIndex = 0[/b] 'Loads First Item in Combo Box i.e. Visiting Cards at Form Load.




Auto Complete Combo Box as User types in the characters

Private Sub cboJobList_KeyDown(KeyCode As Integer, Shift As Integer)

    If KeyCode = 46 Then KeyCode = 0 'Disable the delete key
    miSelStart = cboJobList.SelStart

End Sub

Private Sub cboJobList_KeyPress(KeyAscii As Integer)
    'Sub for Auto Complete Combo Box
    
    Dim lCnt       As Long 'Generic long counter
    Dim lMax       As Long
    Dim sComboItem As String
    Dim sComboText As String 'Text currently in combobox
    Dim sText      As String 'Text after keypressed

    With cboJobList
        lMax = .ListCount - 1
        sComboText = .Text
        sText = Left(sComboText, miSelStart) & Chr(KeyAscii)
        
        KeyAscii = 0 'Reset key pressed
        
        For lCnt = 0 To lMax
            sComboItem = .List(lCnt)
            
            If UCase(sText) = UCase(Left(sComboItem, Len(sText))) Then
                .ListIndex = lCnt
                .Text = sComboItem
                .SelStart = Len(sText)
                .SelLength = Len(sComboItem) - (Len(sText))
                
                Exit For
            End If
        Next 'lCnt
    End With
End Sub




I found collected these solutions from various sites and all these works great. :scooter:

Thanks to all of you, am halfway in my project now and will post the complete code as I finish it.

Regards
Was This Post Helpful? 0
  • +
  • -

#7 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,780
  • Joined: 26-March 09

Re: VB6 - Displaying Information (Running Text)

Posted 23 November 2011 - 06:00 AM

Raaj71, thanks for posting back your solutions, which makes this post complete now, so someone searching on the same issue can read through the whole thread and find an answer at the end.

Once again, well done on solving your problem and good luck in the remainder of your project.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1