Clearing text fields of a vb.net vs2008 project

Summary: There are several fields on the web page that allow the user to enter payments. After the system processes the payments, the fields were not cleared. Therefore, my task is simply to clean them. These are a few lines of code:

' first insert the transaction
InsertANewTransaction()

'clear out the values
txtAddTransAmount.Text = ""
ddlAddTransTypes.SelectedIndex = -1
txtComment.Text = ""

' then create and print the receipt
Payment2MsWordDoc(Payment, PaymentType, PreviousBalance, NewBalance, DueDate, ProjMinPayment)

I added three lines in the middle to reset the values. The problem is that they do not reset. Doing some debugging of the lines of the Payment2MsWordDoc procedure file is the culprit:

Response.AppendHeader("Content-Type", "application/msword")
Response.AppendHeader("Content-disposition", "attachment; filename=" + fileName)
Response.Write(strBody)

The procedure writes the HTML receipt to strBody and displays it to the user. They see "Downloading the file, you want to open or save this file ..." and can open the receipt in the ms-word. Without these three lines, a reset is performed. It’s so clear that they are confusing something, I just don’t understand that.

, , . / . , . VB, -, , .

0
1

, -, . , , ? , . . , , - HTML-, . , . , HTML, doc. HTML - doc .

+1
source

Source: https://habr.com/ru/post/1745131/


All Articles