Hello, it is not necessary to write code to read a value from the PLC, you just have to open the example project, add the SiemensCom driver as explained by a colleague previously, insert a BasicLabel on the screen and finally put in the property PLCAddressValue for example DB1.DBW0. Well, don't forget to put the SiemensCom driver in the ComComponent property. As well as assigning the IP address to the driver.
In the source code of the driver are all the possible examples for DBs, but also if you change DB1.DB to M, I, Q you can access these memory areas.
Bear in mind that this driver forces you to define access to a DB as not optimized or something like that in the TIA Portal project.
I hope I have helped you with your question ...
Greetings...