Sending an SMS from Vb .net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I'm using the code from the MSDN library Article titled: "sending SMSs from your Microsoft .NET Compact Framework-based Applications" to send a SMS.

Now, is it possible to get a status report (delivery report) for the message.

Also is it possible to change the reply button (when a text message arrives, or in outlook when we read mails) to startup my application instead of outlook.

BTW the development is being done in VB .Net

Thanks
Kind Regards

Vishal Rastogi
 
The article with code can be found here:-
http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfsendsms.asp?frame=true

Technically it should be possible by P/Invoking the SmsGetMessageStatus
function which uses the message identifier returned from the SmsSendMessage
call and can return the status, optionally waiting until status is received.
This function is available in the Smart Device Framework however there is a
bug in the v1.1 release which prevents the OpenNETCF.Phone.Sms class from
being used, you can use the sourcecode version available online -
http://www.opennetcf.org/SourceBrow...CF/InetPub/wwwroot/Source/OpenNETCF.Phone/Sms

The code is in C# but can be converted to VB.NET (or built into a C# dll and
then called from your VB.NET application)

Peter
 
Hi Peter,

Thanks for your reply.

I've got the following code which you had actually posted for me earlier.

Dim addr As New OpenNETCF.Phone.Sms.SmsAddress
addr.Type = OpenNETCF.Phone.AddressType.International
addr.Address = "+1234567890"

Dim smssender As New OpenNETCF.Phone.Sms.Sms
Dim messageid As Integer

'send the message
messageid = smssender.SendMessage(addr, "Hello mobile phone user")

Dim status As OpenNETCF.Phone.Sms.SmsMessageStatus
status = smssender.GetStatus(messageid)


I've built the dll from the source, but everytime i add the opennetcf.phone dll to my project it gives me the following error:

Error: The dependency 'mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=969db8053d3322ac' in project 'SmartDeviceApplication2' cannot be copied to the run directory because it would conflict with dependency 'mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

I've tried adding the mscorlib.dll file as a reference to my project, that doesnt throw up the error but since my code is in the form_load event it gives the following error:

system.type_load exception occurred.

Any ideas and any chace of you sending me the dll incase i havent built it properly.

My email address is: (e-mail address removed)

Thanks
Kind Regards

Vishal
 
The error means that you have a reference to the desktop version of
mscorlib - either directly or from one of the other components

--
Alex Feinman
---
Visit http://www.opennetcf.org
Vishal Rastogi said:
Hi Peter,

Thanks for your reply.

I've got the following code which you had actually posted for me earlier.

Dim addr As New OpenNETCF.Phone.Sms.SmsAddress
addr.Type = OpenNETCF.Phone.AddressType.International
addr.Address = "+1234567890"

Dim smssender As New OpenNETCF.Phone.Sms.Sms
Dim messageid As Integer

'send the message
messageid = smssender.SendMessage(addr, "Hello mobile phone user")

Dim status As OpenNETCF.Phone.Sms.SmsMessageStatus
status = smssender.GetStatus(messageid)


I've built the dll from the source, but everytime i add the
opennetcf.phone dll to my project it gives me the following error:
Error: The dependency 'mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=969db8053d3322ac' in project 'SmartDeviceApplication2' cannot
be copied to the run directory because it would conflict with dependency
'mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'.
I've tried adding the mscorlib.dll file as a reference to my project, that
doesnt throw up the error but since my code is in the form_load event it
gives the following error:
 
Thats strange, because i'm using all the normal references that are there by default. Any idea how i can resolve this ?

Thanks
Vishal
 
If you remove all your third-party references from the project (and
mscorlib) then re-add a reference to mscorlib.dll (ensure it is the one in
the Compact Framework folder) then re-add your other references.

Peter
 
Hello Peter,

I tried what you said and it still gives me the error. I think that I may not be building the dll properly. Is there any place where I can download the prebuilt dll ?

Thanks
Kind Regards

Vishal Rastogi
 
Back
Top