Change button text on clicking button

Scot King 116 Reputation points
2021-10-11T01:32:24.453+00:00

I'm clicking a button in vb.net and the button opens up a modal popup. After I change something in the popup and click the button on the popup, the popup closes. My goal here is to change the button text after making the change via the popup. The code I have here below is not working. It seems that it should be working though. Can someone explain why it's not working? I have debugged it and it the function is returning the correct text, but the page is not changing the button.

Protected Sub btndiscountfee_Click(sender As Object, e As EventArgs)
initialize(sender, e)
txtfeename.Text = "Loan Discount Fee"
Dim tblfeesplitadapter As New FeesplitTableAdapter
Dim feesplit As New DataSet1.FeesplitDataTable
feesplit = tblfeesplitadapter.GetData(CInt(Session("ApplicantID")))
For Each feesplitrow As DataSet1.FeesplitRow In feesplit
ddparty.SelectedIndex = feesplitrow.discpty
Rbsplit.SelectedIndex = feesplitrow.discsplit
If feesplitrow.discsplit = 0 Then
Dim results As String() = feesplitrow.discpntamt.Split(",")
If txtdiscounttotal.Text <> "" Then
Dim btntext As String = assignpercent(sender, e, results, txtdiscounttotal.Text)
btndiscountfee.Text = btntext
End If
Else
Dim results As String() = feesplitrow.discpntamt.Split(",")
assignamt(sender, e, results)
End If
Next

Protected Function assignpercent(sender As Object, e As EventArgs, ByVal results As Array, ByVal amount As Decimal) As String
Dim borfee As Decimal, selfee As Decimal, bkrfee As Decimal, lenfee As Decimal, ptyfee As Decimal, corfee As Decimal, totpercent As Decimal = 0
Dim buttontext As String = ""
txtborpercent.Text = results(0)
txtsellerpercent.Text = results(1)
txtbrokerpercent.Text = results(2)
txtlenderpercent.Text = results(3)
txt3partypercent.Text = results(4)
txtcorrespercent.Text = results(5)
If results(0) <> "" Then
borfee = amount * results(0) / 100
txtborfee.Text = borfee
totpercent = results(0)
If results(0) = "100" Then
buttontext = "Borrower"
Else
buttontext = "Multiple"
End If
End If
If results(1) <> "" Then
selfee = amount * results(1) / 100
txtsellerfee.Text = selfee
totpercent = totpercent + results(1)
If results(1) = "100" Then
buttontext = "Seller"
Else
buttontext = "Multiple"
End If
End If
If results(2) <> "" Then
bkrfee = amount * results(2) / 100
txtbrokerfee.Text = bkrfee
totpercent = totpercent + results(2)
If results(2) = "100" Then
buttontext = "Broker"
Else
buttontext = "Multiple"
End If
End If
If results(3) <> "" Then
lenfee = amount * results(3) / 100
txtlenderfee.Text = lenfee
totpercent = totpercent + results(3)
If results(3) = "100" Then
buttontext = "Lender"
Else
buttontext = "Multiple"
End If
End If
If results(4) <> "" Then
ptyfee = amount * results(4) / 100
txt3partyfee.Text = ptyfee
totpercent = totpercent + results(4)
If results(4) = "100" Then
buttontext = "3rd Party"
Else
buttontext = "Multiple"
End If
End If
If results(5) <> "" Then
corfee = amount * results(5) / 100
txtcorresfee.Text = corfee
totpercent = totpercent + results(5)
If results(5) = "100" Then
buttontext = "Correspondent"
Else
buttontext = "Multiple"
End If
End If
txtfeepercent.Text = totpercent
txtfeeamount.Text = borfee + selfee + bkrfee + lenfee + ptyfee + corfee
Return buttontext
End Function

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,768 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Scot King 116 Reputation points
    2021-10-11T17:53:38.98+00:00

    Dim btntext As String = assignpercent(sender, e, results, txtdiscounttotal.Text)
    btndiscountfee.Text = btntext

    This HERE. This on the page not the modal. This button is what opens the modal popup. It is not working.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.