declare event

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gdijim
    New Member
    • Jun 2007
    • 3

    #1

    declare event

    I'm trying to get the following code to work -

    Private Sub RadButton5_Clic k(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles RadButton5.Clic k


    With Me.RadComboBox1

    If Me.RadComboBox1 .FindItemExact( Me.RadComboBox1 .Text) Is Nothing Then

    Dim item1 As Telerik.WinCont rols.UI.RadComb oBoxItem = New Telerik.WinCont rols.UI.RadComb oBoxItem(Me.Rad ComboBox1.Text)

    .Items.Add(item 1)
    End If

    End With



    Dim rd As VncSharp.Remote Desktop = New VncSharp.Remote Desktop



    rd.ConnectCompl ete += New ConnectComplete Handler(Connect Complete)
    rd.ConnectionLo st += New EventHandler(Co nnectionLost)
    rd.Connect(RadC omboBox1.Text)

    End Sub

    This last few lines tell me that I'm not declaring or using events correctly, but I have no idea how to declare or apply this event. Can someone show me how and explain in detail why? I've run into this a few times now, and I think it's a big piece that I'm missing.

    Thanks in advance!

    Jim
    Last edited by gdijim; Jun 24 '07, 08:22 AM. Reason: Foolish typos
  • vanc
    Recognized Expert New Member
    • Mar 2007
    • 211

    #2
    rd.ConnectCompl ete += New ConnectComplete Handler(Connect Complete)
    rd.ConnectionLo st += New EventHandler(Co nnectionLost)
    rd.Connect(RadC omboBox1.Text)

    This last few lines tell me that I'm not declaring or using events correctly, but I have [B]no idea how to declare or apply this event[/B]. Can someone show me how and explain in detail why? I've run into this a few times now, and I think it's a big piece that I'm missing.

    Did you create custom events yourself, if so, you should have known how to use them. Is it your problem or else?

    cheers.

    Comment

    • gdijim
      New Member
      • Jun 2007
      • 3

      #3
      I admit that I'm trying to plug code together that's translated from C# and I don't have a very full understanding of the way to make it work. I'm still pretty weak at object oriented programming.

      Let me link you what I'm trying to do:

      http://cdot.senecac.on .ca/projects/vncsharp/quickstart.html


      Can you help me understand how to declare and use the event handlers he has here? The trouble I'm also having is it's in C# and I don't know if the translation I have is correct.

      I can connect fine to the VNC server, but because I don't have the event handlers set up, every time I copy and paste, it crashes the program. I'm certain it's because the library doesn't know I'm logged in with VNC, because the connectcomplete event hasn't fired.


      Sorry to be a newb, but if you can explain this thoroughly, I'll be able to pick it up and it will answer LOTS of questions I have.


      ----------------

      One other thing about this library I don't understand - The version 0.88 library was added to my toolbox fine, but when I tried the version 0.9 library, it tells me it has nothing to add to the toolbox. I'd like to the use the newest library, but I can't seem to get it to work. Does it need to be built by me first, even though there is a bin available? I'm using VB2005 express.

      Thanks very much in advance,
      Jim

      Comment

      • kenobewan
        Recognized Expert Specialist
        • Dec 2006
        • 4871

        #4
        I agree with vanc there is not much advantage in explaining eventhandlers and code you don't understand. The analogy is that you need to walk before you can run. You'll find the experts on this site did a course or studied a book first. We were all newbies once, but we are dealing in specialized programming.

        My suggestion is to learn the basics first and then come back when you have a problem. There are many resources to get you started. Maybe you disagree or you have a project deadline, the choice of course is yours.

        Comment

        Working...