help i am going mad 
Author Message
 help i am going mad

hello there, i hope you can help me.

I want to display 50 messages on the screen one at a time. (error messages
from a machine via a 40 channel ARCOM pci input card installed in my pc) How
can i get them to cycle on the screen every time i click on a "test" button
also on the screen. I have called them all the following:-

Dim message$(50)

message$(1)="Machine healthy..."
message$(2)="Machine faulty..."
etc............

Every click i want the previous message to disappear and the next one to
appear.

please help as i have little hair left on my head

dave



Wed, 18 Jun 1902 08:00:00 GMT  
 help i am going mad


Wed, 18 Jun 1902 08:00:00 GMT  
 help i am going mad
I have enclosed a zipped sample (VB6) of my solution to your hair
loss!

If you have any question e-mail me.

HTH

Macros-The-Black

On Tue, 19 Sep 2000 19:28:50 +0100, "Chicken Satay"

Quote:

>hello there, i hope you can help me.

>I want to display 50 messages on the screen one at a time. (error messages
>from a machine via a 40 channel ARCOM pci input card installed in my pc) How
>can i get them to cycle on the screen every time i click on a "test" button
>also on the screen. I have called them all the following:-

>Dim message$(50)

>message$(1)="Machine healthy..."
>message$(2)="Machine faulty..."
>etc............

>Every click i want the previous message to disappear and the next one to
>appear.

>please help as i have little hair left on my head

>dave



Wed, 18 Jun 1902 08:00:00 GMT  
 help i am going mad


Wed, 18 Jun 1902 08:00:00 GMT  
 help i am going mad
Dave,

Create a new project, put a Label (lblMessage) on the form, along with to
CommandButtons (cmdNextMessage and cmdPreviousMessage).
Past the following code, and see (= understand) how it works:

=====================================
Option Explicit

Dim m_iMessage As Integer

Dim m_sMessage(50) As String

Private Sub ShowMessage()
    lblMessage.Caption = m_sMessage(m_iMessage)
End Sub

Private Sub cmdNextMessage_Click()
    'Increase the message number
    m_iMessage = m_iMessage + 1

    'If the number exceeds the last message
    If m_iMessage > UBound(m_sMessage) Then
        'Set the message number to the first one
        m_iMessage = LBound(m_sMessage)
    End If

    'Show the current message
    ShowMessage
End Sub

Private Sub cmdPreviousMessage_Click()
    'Decrease the message number
    m_iMessage = m_iMessage - 1

    'If the number exceeds the first message
    If m_iMessage < LBound(m_sMessage) Then
        'Set the message number to the last one
        m_iMessage = UBound(m_sMessage)
    End If

    'Show the current message
    ShowMessage
End Sub

Private Sub Form_Load()
    'Fill the list with messages
    m_sMessage(1) = "Machine healthy..."
    m_sMessage(2) = "Machine faulty..."

    'Set a default message number
    m_iMessage = 0

    'Show the current message
    ShowMessage
End Sub
=====================================

The above works, but you see only one message at a time, and have to cycle
through all the messages to find the one you like to see.
I suggest to use a ListBox and fill it with all the messages:

To try it, create a new project, and put a ListBox (lstMessage) on the form.
Also put two TextBoxes (txtNumber and txtMessage) on the form, just to show
how to update the ListBox
Past the following code, and see if it fills your needs:

=====================================
Option Explicit

Private Sub UpdateMessage(iMessageNumber As Integer, sMessage As String)
    'Check if the message number is valid
    If iMessageNumber < 0 Or iMessageNumber > lstMessage.ListCount - 1 Then
        'If not, don't update
        Exit Sub
    End If

    'Update the message
    lstMessage.List(iMessageNumber) = sMessage

    'Select the updated message
    lstMessage.ListIndex = iMessageNumber
End Sub

Private Sub Form_Load()
    'Fill the ListBox with messages
    lstMessage.AddItem "Machine healthy..."
    lstMessage.AddItem "Machine faulty..."

    'Select a default message in the list
    lstMessage.ListIndex = 0
End Sub

Private Sub lstMessage_Click()
    txtNumber.Text = lstMessage.ListIndex
    txtMessage.Text = lstMessage.Text
End Sub

Private Sub txtMessage_Change()
    UpdateMessage txtNumber.Text, txtMessage.Text
End Sub
=====================================

Hope this helps,
Johan.



Quote:
> hello there, i hope you can help me.

> I want to display 50 messages on the screen one at a time. (error messages
> from a machine via a 40 channel ARCOM pci input card installed in my pc)
How
> can i get them to cycle on the screen every time i click on a "test"
button
> also on the screen. I have called them all the following:-

> Dim message$(50)

> message$(1)="Machine healthy..."
> message$(2)="Machine faulty..."
> etc............

> Every click i want the previous message to disappear and the next one to
> appear.

> please help as i have little hair left on my head

> dave



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. PLEASE, PLEASE HELP, am I going MAD - Generating Totals

2. Am I going mad?

3. Am I going mad??

4. ARRRRRGH Access cross over going mad HELP!

5. I AM GETTING MAD AT THIS

6. I AM GETTING MAD AT THIS !!!!!

7. Going mad over received mail

8. Combobox Gone Mad

9. Major Bug in VB.NET (or i've gone mad)

10. Text-Driver, Access 2000 and CSVs, I'm going totally mad

11. ADO Recordset gone mad!

12. OCX Registration gone MAD!

 

 
Powered by phpBB® Forum Software