Hi,

I'm trying to change the button backcolor once the Done event is completed. But it didn't work..

Public Event Done()

Private Sub checkinput()
        'Port = ReceivedString.Split("&")
        'For i = 0 To UBound(Port)
        'Debug.Print("Port: " + Port(i))
        'Next i
        RaiseEvent Done()
End Sub

Private Sub changecolor() Handles Me.Done
        RD6.BackColor = Color.Lime
        Debug.Print("here")   ' Here is actually printed
End Sub

Any hints?

I've had a quick look at this; seems to work fine when you call the checkinput() sub. I ran it calling checkinput() on form load and it changed the button to lime.

Public Class Form1


    Public Event Done()

    Private Sub checkinput()

        'Port = ReceivedString.Split("&")

        'For i = 0 To UBound(Port)

        'Debug.Print("Port: " + Port(i))

        'Next i

        RaiseEvent Done()

    End Sub

    Private Sub changecolor() Handles Me.Done

        rd6.BackColor = Color.Lime

        Debug.Print("here") ' Here is actually printed

    End Sub



    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        checkinput()
    End Sub


End Class

Hmm.. i should have called for it when the form loads...
The full code is as below, but i ran into trouble when calling this function. ReceivedString is initialise as "", and will be set by Form1

' This is Form2
    Public Event Done()
    Public ReceivedString As String

    Public Property MyProperty() As String
        Get
            Return ReceivedString
        End Get
        Set(ByVal value As String)
            ReceivedString = value
        End Set
    End Property

    Private Sub checkinput()
       Port = ReceivedString.Split("&")  ' Must be set before spliting
         For i = 0 To UBound(Port)
        Debug.Print("Port: " + Port(i))
        Next i
        Debug.Print("in checkinput")
        RaiseEvent Done()
    End Sub

    Private Sub changecolor() Handles Me.Done
        RD7.BackColor = Color.Lime
        Debug.Print("here")
    End Sub

    Private Sub TunnelGUI_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub

How should I approach this problem? :yawn:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.