Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9000049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:15:41+00:00 2026-06-16T00:15:41+00:00

I have a vb.net function is which I am doing some thing which is

  • 0

I have a vb.net function is which I am doing some thing which is returning a gridview to send it in email.Problem is that when I call the function in email then email is sent even there is nothing returned by function. I don’t to send blank email at all. I want to when function return nothing then it shouldn’t send email. Here is My function

Public Function emaildata(ByVal grdv As GridView, ByVal chk As String, ByVal celpos As Integer) As GridView
        Dim comm As OleDbCommand = New OleDbCommand()
        Dim bpv As String = ""
        Dim gv As New GridView
        For Each gvrow As GridViewRow In grdv.Rows
            Try
                Dim rdobtn As RadioButtonList = CType(gvrow.FindControl(chk), RadioButtonList)
                If rdobtn.SelectedValue.Equals("5") Or rdobtn.SelectedValue.Equals("1") Or rdobtn.SelectedValue.Equals("6") Or rdobtn.SelectedValue.Equals("4") Or rdobtn.SelectedValue.Equals("2") Then
                    If bpv <> "" Then
                        bpv += ","
                    End If
                    bpv += gvrow.Cells(celpos).Text
                    comm.CommandText = "SELECT row_number() over(order by rownum) Sr, to_char(chq_num) Cheque#,to_char(bpv_amt,'9,999,999,999') Amount,vch_nar Narration,bnf_nam PartyName,acc_des Bank from  CHECK_DATA where bpv_num in(" & bpv.ToString() & ") and BPV_DTE=to_date('" & TreeView2.SelectedValue & "') union all SELECT null,'Total :',to_char(sum(bpv_amt),'9,999,999,999') Amount,null,null,null from  CHECK_DATA where bpv_num in(" & bpv.ToString() & ") and BPV_DTE=to_date('" & TreeView2.SelectedValue & "')"
                    comm.CommandType = CommandType.Text
                    comm.Connection = con
                    Dim da As New OleDbDataAdapter(comm)
                    Dim ds As New DataSet
                    da.Fill(ds)
                    gv.DataSource = ds
                    gv.DataBind()
                End If
            Catch ex As Exception
                Response.Write("There is Problem In Cheque Approval System Please Contact With IT")
            End Try
        Next
        Return gv
    End Function

And I Call this in email function as a subject like this

email("malik.adeel@shakarganj.com.pk", "[Cheque Approval] GM Finance Reviewed (" & TreeView2.SelectedValue & ")" & subsmcnt(GridView5, "chkStatusGM", 4), gridhtm(emaildata(GridView5, "chkStatusGM", 4)))

How can I do this that if emaildata(GridView5, "chkStatusGM", 4) returning nothing email shouldn’t be sent?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:15:41+00:00Added an answer on June 16, 2026 at 12:15 am

    Probably the easiest is to check if the GridView contains GridViewRows with the Count property:

    Dim grdEmail = emaildata(GridView5, "chkStatusGM", 4)
    If grdEmail.Rows.Count > 0
        email("malik.adeel@shakarganj.com.pk", 
              "[Cheque Approval] GM Finance Reviewed (" & TreeView2.SelectedValue & ")" & subsmcnt(GridView5, "chkStatusGM", 4), 
              gridhtm(grdEmail))
    End If 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does .NET have some type of built in function that allows filtering on Gridviews?
I have an application in vb.net that starts with a sub function do some
I have a VB.Net function which executes a Oracle Stored Proc and returns a
Say I have a function that does the following in Vb.net For i as
Does .net have the equivilent of Delphi's QuotedStr function. This replaces all quotes with
I have asp.net generated html code. I want execute jQuery click function when user
I have two asp.net textboxes and need to put a validate function in javascript
I have gone through this page... http://www.php.net/manual/en/function.hash.php MD5 is 32 characters long while sha1
I have a function in a VB.Net script file, but it produces the error
I have a generic function in VB.Net. I also have two classes called A

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.