0

I am Using NDDE to get data from server. The problem is that I dont know how to get multiple items.

I searched a lot. There is a code in c# which get multiple items. I convert it to vb but I cant fint the alternative of this line

client.Advise += OnAdvise;

Public Sub ConnectToDDE
  Dim list As New List(Of String)        
  list.Add("1010")        
  list.Add("2020")        
  list.Add("3030")        
  list.Add("4040")        
  list.Add("TASI")               
  Try            

    If client.IsConnected Then client.Disconnect()       
  Catch        
  End Try        
  Try                       
    client = New DdeClient(txtDDEServer.Text, txtDDETopic.Text, Me)            
    client.Connect()            
    'client.Advise += OnAdvise; Should be here '
    For i As Integer = 1 To list.Count - 1                
      client.StartAdvise("QO." & list(i) &     ".TAD$high", 1, True, 60000)            
    Next        
  Catch ex As Exception            
    displayTextbox.Text = ex.Message            
  End Try    
End Sub

Is there an alternative of client.Advise += OnAdvise; in vb, if not how can I get multiple items from server.

The server provides stock prices (Symbol,name,open,high,low,close)

server name = tickerchart

topic = live

there are many items I need are (Symbol,name,open,high,low,close)

example :

    client.StartAdvise("QO.1010.TAD$high", 1, True, 60000)

This item gets the high price for stock 1010. how to get the rest.

4

1 回答 1

4

我不熟悉 NDde 库,但client.Advise += OnAdvise;看起来像添加一个事件处理程序,因此 VB.NET 等效项类似于:

AddHandler client.Advise, AddressOf OnAdvise

具有适当签名的子程序在哪里OnAdvise,可能类似于:

Private Sub OnAdvise(sender As Object, e As DdeAdviseEventArgs)
    ' Do something here...
End Sub
于 2014-11-21T22:35:16.553 回答