Step 3: Reading and writing values

<< Click to Display Table of Contents >>

Manual > Server Creation Guide > Interface > DDE Interface > DDE connection from VisualBasic.NET >

Step 3: Reading and writing values

Step 3: Reading and writing values

We will introduce how to read and write item values at any time.

 

 

Import

 

Item values can be read at any time. Reading is done with "FnDdeRequest".

 

In the sample, the value is read by pressing the Read button.

 

c_interface_0083

 

'------------------------------------------
' DDE Read
'------------------------------------------
Private Sub btRead_Click(sender As System.Object, e As System.EventArgs) Handles btRead.Click

    Dim vItemName As String = txItemName1.Text
    txRead.Text = FnDdeRequest(mvConv, vItemName)

End Sub

 

 


write

 

Write the item value at any time. Read it with "FnDdePoke".

 

In the sample, the value is written by pressing the Write button.

 

c_interface_0084

 

'------------------------------------------
' DDE Write
'------------------------------------------
Private Sub btWrite_Click(sender As System.Object, e As System.EventArgs) Handles btWrite.Click

    Dim vItemName As String = txItemName2.Text
    FnDdePoke(mvConv, vItemName, txWrite.Text)

End Sub

 

 

hint

Among the code written in the Common class (Common.vb), the important methods are as follows:

 

command

explanation

DdeInitializeA

This is a command to start DDE communication. Specify the server application name and topic name. If successful, it returns a DDE communication channel. Use this channel to execute other DDE communication related commands.

DdeConnect

Makes a connection to a DDE server.

DdeDisconnect

Disconnect from the DDE server.

DdeGetData

Retrieve the data.

DdeClientTransaction

Initiates a data transaction between a client and a server.