|
Simple Visual Basic Write Tutorial - Minimal Code
This example builds upon the previous simple read example to add write capabilities to the solution. As you'll see writing data
points is almost as easy as reading - it only takes 1 line of code. If you'd like, you can download this program with VB6 source code.
Starting with the form we finished the simple read with, we'll add a text box to enter a
value to write in and a command button as shown here. We've set the .Caption property on the command button to say "Write Value" purely for appearances here.
Now if you double click on the Write Value button in VB, you'll get your code window - enter the
code shown below inside the Command1_Click() procedure and you're done! If you look at the code below closely you'll see that one line
of code does all the work - the rest is simple variable declarations and settings.
Run your program, type a value in the text box on the bottom of the form and click the
"Write Value" button and you'll see the value appear in one of the two text boxes you setup in the simple read example.
|