Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21090

[RESOLVED] how to check if values are empty before sending sms or email

$
0
0
i have a form that sends sms
now i'm trying to check if a text box is empty then it could not be sent
and if everything is ok then i get msgbox sent successfully
i know im doing something wrong here
this is my code:
Code:

  Dim SendToAll As String
    LsVw.SetFocus
    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) & "; "
        End If
    Next
    If SendToAll = vbNullString Then
        MsgBox "you need to choose at least 1 customer from the list to send a sms", vbExclamation
        Check1.Value = vbUnchecked
        LsVw.SetFocus
          If Txt(5).text = "" Then
          MsgBox "missing fields", vbExclamation
          End If
    Else
        retval = sendsms(UserSmsUid, UserSmsUn, Txtmsg, SendToAll, Txt(5).text)
        'ShellExecute hWnd, "open", "mailto:" & SendToAll, vbNullString, vbNullString, SW_SHOW
    End If
    Check1.Value = 0
    CmbGreeting.ListIndex = -1
    LsVw.SetFocus
    With LsVw
    For i = 1 To .ListItems.Count
        .ListItems(i).Checked = False
        .ListItems(i).Selected = False
    Next
    MsgBox "the message successfully sent", vbInformation
    End With
    Call LoadCust


Viewing all articles
Browse latest Browse all 21090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>