Receiving SMS

zack

Well-known member
Joined
Jun 9, 2005
Messages
65
Programming Experience
Beginner
:( Hi all,

Do anyone here has an example on receiving SMS besides the one from MSDN?
Because the one from MSDN is giving me a terrible headche. I need a pure vb.net program.

Thanks a million!
 
there are a number of C# to VB converters available

but here's what i converted roughly in 2mins:
VB.NET:
C#
// Create XML message
MemoryStream ms = new MemoryStream();
XmlTextWriter xmlw = new XmlTextWriter(ms, System.Text.Encoding.UTF8);
xmlw.WriteStartDocument();
xmlw.WriteStartElement("Delivery");
xmlw.WriteElementString("PackageID", lblPackageID.Text);
xmlw.WriteElementString("Delivered", txtDelivered.Text);
xmlw.WriteEndElement();
xmlw.WriteEndDocument();
xmlw.Flush();
ms.Seek(0, SeekOrigin.Begin);
StreamReader sr = new StreamReader(ms);
txtMessage.Text = sr.ReadLine();
lblMessage.Text = "Message (" + txtMessage.Text.Length.ToString() + " 
  chars):";
this.Refresh();
xmlw.Close();
sr.Close();

// Send message
if (0 == SMSHelper.SendSMS("+15555550123", txtMessage.Text))
  MessageBox.Show("Message sent!", this.Text, MessageBoxButtons.OK,
	MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
else
  MessageBox.Show("Could not send message!", this.Text);


VB.Net
'Create XML message
Dim ms As New MemoryStream()
Dim xmlw As New XmlTextWriter(ms, System.Text.Encoding.UTF8)
With xmlw
  .WriteStartDocument()
  .WriteStartElement("Delivery")
  .WriteElementString("PackageID", lblPackageID.Text)
  .WriteElementString("Delivered", txtDelivered.Text)
  .WriteEndElement()
  .WriteEndDocument()
  .Flush()
End With
ms.Seek(0, SeekOrigin.Begin)
Dim sr as New StreamReader(ms)
txtMessage.Text = sr.ReadLine()
lblMessage.Text = "Message (" & txtMessage.Text.Length.ToString() & "chars):"
Me.Refresh()
xmlw.Close()
sr.Close()

'Send message
If 0 = SMSHelper.SendSMS("+15555550123", txtMessage.Text)
  MessageBox.Show("Message sent!", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
Else
  MessageBox.Show("Could not send message!", Me.Text)
End If
 
Hi JuggaloBrotha,

I think you misinterpreted my call for help. I actually asked if there is anyone with a vb .net code that has the ability to retreive SMS from the inbox and possibly even detect a new incoming SMS.

Sorry about that. :(
 
Hi JuggaloBrotha,

Thanks for your help. But this program uses embedded visual C++ and vb .net at the same time -> it seems too profound to me. It is possible for me to send you my codes and hope you could spare some time on it to help me convert it to vb .net?

Please kindly leave your email address for me if you agree to help.

Thanks a million! :)
 
JuggaloBrotha said:
i just did a quick google search and found this: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/ReceivingSMSMessages.asp

it's in c# but it can be converted to vb.net

Hi JuggaloBrotha, Have you tried the sample yourself before?

according to Maarten's article, I can successfully deploy it using the pcoket pc 2003 emulator, but there is a problem when I deploy it to my pocket PC.

These are the steps that I followed:
1) Build the mapirule successfully
2) Change the dll in the CaptureSMS program to the dll that is found in the emulatorRel
3) Deploy to pocket PC

But this is the error I get: An unhandled exception of type 'System.MissingMethodException' occurred in CaptureSMS.exe

And this line of code is highlighted: if (DllRegisterServer() != 0)

Can you tell me what I have done wrong or what steps I have missed?
 
Hi

zack said:
Hi JuggaloBrotha, Have you tried the sample yourself before?

according to Maarten's article, I can successfully deploy it using the pcoket pc 2003 emulator, but there is a problem when I deploy it to my pocket PC.

These are the steps that I followed:
1) Build the mapirule successfully
2) Change the dll in the CaptureSMS program to the dll that is found in the emulatorRel
3) Deploy to pocket PC

But this is the error I get: An unhandled exception of type 'System.MissingMethodException' occurred in CaptureSMS.exe

And this line of code is highlighted: if (DllRegisterServer() != 0)

Can you tell me what I have done wrong or what steps I have missed?
Can u tell does this sample worked coz i am also getting the same error can u help me plzzzzzzzzz
 
Back
Top