Please see my comment to the question. This is not a valid question; the only reason for me to place an answer is that I remember your previous question. I still don't know what was your failure or problem, so I'll only discuss some apparent problems.
Let's see:
The line
Dim i As Integer = ListBox1.Items.Count - 1
is never used. It is the line remained from your previous code sample from your previous question; at that time, it also did not make any sense at all. Finally, remove it. And, come on: you should understand every single line you write, otherwise your whole work makes no sense. You should write code, not using trial-and-error approach.
As you asked before, you needed, to send the content of the list box items to the serial port. I have no idea what are in your items, but let me assume that you simply want to send the text shown in each item. In this case, use
item.ToString
. It can be assumed, but what you do is not conceptually correct; the type of the item is
System.Object
, so it can contain any data. In other cases, you should type-cast item type to its real
runtime type (do you know what is that?) and get whatever data it carries.
Don't use multiple string/character concatenation ('&'). Strings are immutable. Do I even have to explain the consequences? Anyway, use string.Format instead:
http://msdn.microsoft.com/en-us/library/system.string.format%28v=vs.110%29.aspx[
^].
The above problems tells use that you have little idea on how to write code, but are not immediate reasons of possible failure (which you, again, did not bother to explain).
I cannot see how the serial port was initialized. And it could be initialized with wrong parameters: parity, baud rate, handshake and the like. Please see:
http://msdn.microsoft.com/en-us/library/system.io.ports.serialport%28v=vs.110%29.aspx[
^].
It majorly depends on the requirements of the device on the other end of your RS-232 cable. By "AT", I can guess it's some modem. You also did not bother to explain what it requires. Check it by yourself according to the device documentation.
—SA