你把VB2008的问题贴发在VB6版块里不是十分恰当。
另个输出到listbox控件里面感觉更不恰当了。
不过也不是不能实现,假定,在你所做的界面中,如你所传的图,文本框名字自上而下依次为textbox1到textbox7,在那个按扭的单击事件里编写如下代码:
程序代码:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim num As Decimal
ListBox1.Dock = DockStyle.Fill
num = CDec(TextBox5.Text) + CDec(TextBox6.Text) + CDec(TextBox7.Text)
ListBox1.Items.Clear()
ListBox1.Items.Add("Business Travel Expense")
ListBox1.Items.Add(vbCrLf)
ListBox1.Items.Add("Trip to attend meetint of")
ListBox1.Items.Add(TextBox1.Text)
ListBox1.Items.Add(TextBox2.Text & " in " & TextBox3.Text)
ListBox1.Items.Add(vbCrLf)
ListBox1.Items.Add("Meals and entertainment $" & CDec(TextBox4.Text))
ListBox1.Items.Add("Airplane fare $" & CDec(TextBox5.Text))
ListBox1.Items.Add("Lodging $" & CDec(TextBox6.Text))
ListBox1.Items.Add("Taxi fare $" & CDec(TextBox7.Text))
ListBox1.Items.Add(vbCrLf)
ListBox1.Items.Add("Total other than meals and entertainment: $" & num)
ListBox1.Items.Add("50% of meals and entertainment: $" & CDec(TextBox4.Text) / 2)
End Sub
End Class
备注:我在主窗体上加了个listbox控件,放在一边了,为了达到你所发的图片的效果,在运行后将它的Dock属性设置成了fill.
我试运行的界面和结果图片如下: