Send Items in Listbox AT Commands
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Send Items in Listbox AT Commands

  1. #1
    Join Date
    Jan 2012
    Posts
    3

    Send Items in Listbox AT Commands

    I wanted to send the items within a listbox.One item at a time

    this is the code snippet:

    For i = 0 To 5
    SMSPort.Write("AT+CMGS=" & Chr(34) & sender & Chr(34) & vbCrLf)
    SMSPort.Write(listfiles.Items(i).ToString() & vbCr & Chr(26))
    System.Threading.Thread.Sleep(800)
    Next

    And I tried this:
    SMSPort.Write("AT+CMGS=" & Chr(34) & sender & Chr(34) & vbCrLf)
    SMSPort.Write(Textbox1.text & vbCr & Chr(26))
    System.Threading.Thread.Sleep(800)

    Both listbox and textbox don't allow me to send sms.

    There's no error but there are no outputs also. I cannot send any txt messages. However I tried this to test my code.

    For i = 0 To 5
    SMSPort.Write("AT+CMGS=" & Chr(34) & sender & Chr(34) & vbCrLf)
    SMSPort.Write(i+1 & vbCr & Chr(26))
    System.Threading.Thread.Sleep(800)
    Next


    And so I received 5 text messages with outputs: 1 to 5.


    For i = 0 To 5
    SMSPort.Write("AT+CMGS=" & Chr(34) & sender & Chr(34) & vbCrLf)
    SMSPort.Write("arra" & vbCr & Chr(26))
    System.Threading.Thread.Sleep(800)
    Next

    I received 5 SMS with "arra".


    Kindly help me with my problem. I can't figure out what's wrong with my code.

  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,782

    Re: Send Items in Listbox AT Commands

    What is the value of the variable in your Listbox or textbox content? Have you tryed it with the values that worked when hard coded?

    I am not sure how well sleep would work in such a case. I would think it may interupt the write to the port?
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Jan 2012
    Posts
    3

    Re: Send Items in Listbox AT Commands

    Quote Originally Posted by DataMiser View Post
    What is the value of the variable in your Listbox or textbox content? Have you tryed it with the values that worked when hard coded?

    I am not sure how well sleep would work in such a case. I would think it may interupt the write to the port?
    Hi.

    actually I tried sending the contents of any txtbox from my form with contents

    "Hi!, My name is arra"
    "123456"

    I received the messages successfully. But for a textbox with a content of a path : for example: "F:\ARTWORKS\Misc\Arra.jpg"

    no errors.but doesn't send a message. it's so frustrating. I've tried cutting the string to "ARTWORKS\Misc\Arra.jpg", but still no success but if other formats, a word a sentence ,it can send an SMS. it's so weird

  4. #4
    Join Date
    Jan 2012
    Posts
    3

    Re: Send Items in Listbox AT Commands

    Quote Originally Posted by DataMiser View Post
    What is the value of the variable in your Listbox or textbox content? Have you tryed it with the values that worked when hard coded?

    I am not sure how well sleep would work in such a case. I would think it may interupt the write to the port?
    Hi again DataMiser.

    After experimenting a lot of strings. I've come to the conclusion that the symbol "\" backslash prevents me from sending an SMS. When I changed all the backlashes with a "/" symbol. "F:/ARTWORKS/Misc/Arra.jpg", it surprisingly send the text message. it's so upsetting though, because it's not the right symbol for a path.

  5. #5
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,874

    Re: Send Items in Listbox AT Commands

    Try sending TWO of them instead of one. Or, Include in double-quotes
    Code:
     & "\" & myValue
    Maybe even the Drive Letter!
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center