[RESOLVED] sending sms with listview and checkbox in listview
hello everyone
this is a little hard
i have a form that sends sms ok?
now i also i have listview with a checkbox in the same form
what i want to do is to send 1 sms or to all sms from a text1.text
that i write the message (text1.text)
and i pick the person from the listview that this will send the message.
the code of the message i already have
i just want to be able to choose from a listview the contact and send him a message in what i write in the (text1.text)
i hope im understood
*****************
this is what i have in the mail form where i send emails from a listview
Dim SendToAll As String, NoEmails As Boolean
LsVw.SetFocus
NoEmails = True
For I = 1 To LsVw.ListItems.Count
If LsVw.ListItems(I).Checked And Len(Trim$(LsVw.ListItems(I).SubItems(1))) <> 0 Then
SendToAll = SendToAll & LsVw.ListItems(I).SubItems(1) & "; "
NoEmails = False
End If
Next
If Not NoEmails Then ShellExecute hwnd, "open", "mailto:" & SendToAll, vbNullString, vbNullString, SW_SHOW
Unload Me
Last edited by salsa31; May 26th, 2012 at 08:20 AM.
Re: sending sms with listview and checkbox in listview
the sms data in list is name or numbers ? , load data from database to list1 and then select the recivers list which will be add to list 2 , then send sms to list of list 2
Re: sending sms with listview and checkbox in listview
the sms data i write in a text1
now i have a database which i store customers.
this is the sms form.
I dont know what do.
im stuck here
please any ideas for me
Last edited by salsa31; May 27th, 2012 at 05:53 AM.
Re: sending sms with listview and checkbox in listview
and this is the method i use to show the custs from the database
LsVw is Listview
**********************
Set RS = CN.Execute("SELECT * FROM Customers")
LsVw.ListItems.Clear
While Not RS.EOF
Set Itm = LsVw.ListItems.Add(, , RS!FullName)
Itm.Bold = True
Itm.SubItems(1) = RS!Cellular
RS.MoveNext
Wend
If LsVw.ListItems.Count = 0 Then
MsgBox " no custs ", vbInformation
End If
if you can show me how to do it with a listbox that will be great
Re: sending sms with listview and checkbox in listview
this is vbnet
you posted here something erarlier that can be good
load data from database to list1 and then select the recivers list which will be add to list 2 , then send sms to list of list 2.
i never worked with listbox
can you show me an example or help me with this code plz?
Re: sending sms with listview and checkbox in listview
Code:
Option Explicit
Private Sub Form_Load()
Open "C:\Downloads\b.txt" For Input As #1
Dim filesize As Integer
filesize = LOF(1)
Text1 = Input(filesize, #1)
Text1.Visible = False
Close #1
'~~~ When a button is pressed
Dim temp() As String
temp = Split(Text1.Text, vbCrLf) '~~~ Split the lines in the TextBox, separated by a vbCrLf character(newline) and store it in the array
'~~~ Loop through the array
Dim i As Integer
For i = LBound(temp) To UBound(temp)
List1.AddItem temp(i) '~~~ add each element in the array to the listbox
Next
End Sub
draw a textbox and listbox
create a text file
replace the file loocation with ur text file location
Re: sending sms with listview and checkbox in listview
Originally Posted by useruseronline
Code:
Option Explicit
Private Sub Form_Load()
Open "C:\Downloads\b.txt" For Input As #1
Dim filesize As Integer
filesize = LOF(1)
Text1 = Input(filesize, #1)
Text1.Visible = False
Close #1
'~~~ When a button is pressed
Dim temp() As String
temp = Split(Text1.Text, vbCrLf) '~~~ Split the lines in the TextBox, separated by a vbCrLf character(newline) and store it in the array
'~~~ Loop through the array
Dim i As Integer
For i = LBound(temp) To UBound(temp)
List1.AddItem temp(i) '~~~ add each element in the array to the listbox
Next
End Sub
draw a textbox and listbox
create a text file
replace the file loocation with ur text file location
did it work for u ?
this will pull the contacts and their number from the DB?
Re: sending sms with listview and checkbox in listview
i dont understand
i work with access
how do i pull it to the text file?
this is the code that i use to pull the customers from the DB and show it in a listview
***************
Set RS = CN.Execute("SELECT * FROM Customers")
LsVw.ListItems.Clear
While Not RS.EOF
Set Itm = LsVw.ListItems.Add(, , RS!FullName)
Itm.Bold = True
Itm.SubItems(1) = RS!Cellular
RS.MoveNext
Last edited by salsa31; May 27th, 2012 at 09:11 AM.
Re: sending sms with listview and checkbox in listview
Code:
what i need basicly is to choose a contact from the db that will be showed in a list
and choose to who i ever want to send to him a sms
or to send to all sms with their numbers ofcurse.
****************************************
this is another form that i send email to
*********************************
Private Sub Check1_Click()
If Check1.Value = vbChecked Then 'select all
With LsVw
For i = 1 To .ListItems.Count
.ListItems(i).Checked = True
.ListItems(i).Selected = True
TxtFind.Enabled = False
Next i
End With
Else 'desel all
With LsVw
For i = 1 To .ListItems.Count
.ListItems(i).Checked = False
.ListItems(i).Selected = False
TxtFind.Enabled = True
TxtFind.SetFocus
Next i
End With
End If
End Sub
Private Sub Form_Load()
ListRTL LsVw
Set RS = CN.Execute("SELECT * FROM Customers")
LsVw.ListItems.Clear
While Not RS.EOF
Set Itm = LsVw.ListItems.Add(, , RS!FullName)
Itm.Bold = True
Itm.SubItems(1) = RS!Email
Itm.SubItems(2) = RS!Cellular
RS.MoveNext
Wend
If LsVw.ListItems.Count = 0 Then
BttnSend.Enabled = False
TxtFind.Enabled = False
Check1.Enabled = False
Label3.Enabled = False
Label4.Enabled = False
LsVw.Enabled = False
Label1.Enabled = False
Label2.Enabled = False
MsgBox "no custs"
End If
End Sub
Private Sub BttnSend_Click()
Dim SendToAll As String, NoEmails As Boolean
LsVw.SetFocus
NoEmails = True
For i = 1 To LsVw.ListItems.Count
If LsVw.ListItems(i).Checked And Len(Trim$(LsVw.ListItems(i).SubItems(1))) <> 0 Then
SendToAll = SendToAll & LsVw.ListItems(i).SubItems(1) & "; "
NoEmails = False
End If
Next
If Not NoEmails Then ShellExecute hwnd, "open", "mailto:" & SendToAll, vbNullString, vbNullString, SW_SHOW
Unload Me
End Sub
Private Sub BttnClose_Click()
Unload Me
End Sub
Private Sub Timer1_Timer()
Label1.Caption = LsVw.ListItems.Count
End Sub
Private Sub TxtFind_Change()
BttnSend.Enabled = False
BttnClose.Enabled = False
Check1.Enabled = False
Set RS = CN.Execute("SELECT * from Customers WHERE FullName LIKE '%" & RplS(TxtFind.Text) & "%' ORDER BY FullName")
LsVw.ListItems.Clear
While Not RS.EOF
Set Itm = LsVw.ListItems.Add(, , RS!FullName)
Itm.Bold = True
Itm.SubItems(1) = RS!Email
Itm.SubItems(2) = RS!Cellular
RS.MoveNext
Check1.Enabled = True
BttnSend.Enabled = True
BttnClose.Enabled = True
Wend
If TxtFind.Text <> "" Then
Check1.Enabled = False
End If
End Sub
Last edited by salsa31; Apr 2nd, 2013 at 09:56 AM.