B brogrammer New Member Licensed User Longtime User Apr 23, 2013 #1 Hi Erel, I'm trying to use the following piece of code to send an email message when clicked on an item in a ListView. The item clicked holds an email address as String and, when clicked, copies the email address into the TO field of the email messenger. The problem is that it won't... It won't copy the email address and paste it into the TO field. Here is the code: Dim Message As Email Message.To.Add("[email protected]") Message.Attachments.Add(File.Combine(File.DirRootExternal, "Somefile.txt ")) StartActivity(Message.GetIntent) Please share if you have a solution for this, or if you think that I'm doing something wrong. Thank you, Brogrammer.
Hi Erel, I'm trying to use the following piece of code to send an email message when clicked on an item in a ListView. The item clicked holds an email address as String and, when clicked, copies the email address into the TO field of the email messenger. The problem is that it won't... It won't copy the email address and paste it into the TO field. Here is the code: Dim Message As Email Message.To.Add("[email protected]") Message.Attachments.Add(File.Combine(File.DirRootExternal, "Somefile.txt ")) StartActivity(Message.GetIntent) Please share if you have a solution for this, or if you think that I'm doing something wrong. Thank you, Brogrammer.
M Mahares Expert Licensed User Longtime User Apr 23, 2013 #2 This should do it: Code: Copy Dim MyLV As ListView 'global Dim MyEmailAdress As String 'global Sub MyLV_ItemClick (Position As Int, Value As Object) MyEmailAdress=Value End Sub Message.To.Add(MyEMailAddress) Upvote 0
This should do it: Code: Copy Dim MyLV As ListView 'global Dim MyEmailAdress As String 'global Sub MyLV_ItemClick (Position As Int, Value As Object) MyEmailAdress=Value End Sub Message.To.Add(MyEMailAddress)
B brogrammer New Member Licensed User Longtime User Apr 23, 2013 #3 Still no success Thank you for the help. But it still won't work. Here is my whole Sub: Sub ListView1_ItemClick (Position As Int, Value As Object) Dim tr As Tutor : tr = Main.currentTutor Dim t t = ListView1.GetItem(Position) Select t Case tr.getTutorPhone Dim p As PhoneCalls StartActivity(p.Call(tr.getTutorPhone)) Case tr.getTutorEmail Dim Message As Email Message.To.Clear() Message.To.Add(tr.getTutorEmail) Message.Attachments.Add(File.Combine(File.DirRootExternal, " ")) StartActivity(Message.GetIntent) End Select End Sub The case with the Phone Call service works, it reads the phone number off the ListView and calls it. But the second case doesn't. Any ideas why? Appreciate the help. Upvote 0
Still no success Thank you for the help. But it still won't work. Here is my whole Sub: Sub ListView1_ItemClick (Position As Int, Value As Object) Dim tr As Tutor : tr = Main.currentTutor Dim t t = ListView1.GetItem(Position) Select t Case tr.getTutorPhone Dim p As PhoneCalls StartActivity(p.Call(tr.getTutorPhone)) Case tr.getTutorEmail Dim Message As Email Message.To.Clear() Message.To.Add(tr.getTutorEmail) Message.Attachments.Add(File.Combine(File.DirRootExternal, " ")) StartActivity(Message.GetIntent) End Select End Sub The case with the Phone Call service works, it reads the phone number off the ListView and calls it. But the second case doesn't. Any ideas why? Appreciate the help.
Erel B4X founder Staff member Licensed User Longtime User Apr 24, 2013 #4 Please use [ code ] [ /code ] tags (without spaces) when posting code. Put a breakpoint in this case and make sure that the values are as expected. Upvote 0
Please use [ code ] [ /code ] tags (without spaces) when posting code. Put a breakpoint in this case and make sure that the values are as expected.