i have a rich text box that displays items.These items have column names.The column names are loaded when the form loads.They hold values as rows.These rows are appended at a click of a button (when add button is clicked).
At the bottom,let me say i have another field(total amount) in the rtb which displays total value of a Amount column.This is also displayed when calculate button is clicked.
If someone wants to add another row to be calculated it would create the format displayed.so i wanted to clear the total amount field when another item gets added.Is there a way to do that.
Richtextbox1.text = mid(Richtextbox1.text,1,len(richtextbox1.text)-x) & NewTotal
Where x is the length of the previous total and NewTotal is the new total string.
Edit (see comments):
Use this code to solve your issue:
dim numberofcolumns as integer = listview1.ColumnHeaders.Count
dim str(numberofcolumns-1) as string
str(numberofcolumns-2) = "TotalAmount"
str(numberofcolumns-1) = totalammountvariable
Dim itm As ListViewItem
itm = New ListViewItem(str)
ListView1.Items.add(itm)
First Clear All Data and Rebind
RichTextBox1.Clear()
Using this Command clear all data in Richtextbox and rebind you data
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.