
用vb语言编写以下题目: 1、建立一个窗体程序用于计算数学函数:Y=a*X^3+b*X^2+c*X
用vb语言编写以下题目:1、建立一个窗体程序用于计算数学函数:Y=a*X^3+b*X^2+c*X+d的值,并将计算的函数值显示。为此,窗体上摆放有5个文本框,用来输入系数...
用vb语言编写以下题目:
1、建立一个窗体程序用于计算数学函数:Y=a*X^3+b*X^2+c*X+d 的值,并将计算的函数值显示。为此,窗体上摆放有5个文本框,用来输入系数及自变量:a、b、c、d、X;一个标签,用来显示函数值;一个命令按钮,用来启动计算。建立一个函数过程来完成具体计算,它将被命令按钮的Click事件中的语句调用。
2、建立一个含有窗体的标准程序,窗体上有两个列表框:List1、List2,一个命令按钮:Command1。要求建立这样的程序,使得当Command1被单击时,List1中被选中的项目移入到List2中。
需要详细的vb语言程序! 展开
1、建立一个窗体程序用于计算数学函数:Y=a*X^3+b*X^2+c*X+d 的值,并将计算的函数值显示。为此,窗体上摆放有5个文本框,用来输入系数及自变量:a、b、c、d、X;一个标签,用来显示函数值;一个命令按钮,用来启动计算。建立一个函数过程来完成具体计算,它将被命令按钮的Click事件中的语句调用。
2、建立一个含有窗体的标准程序,窗体上有两个列表框:List1、List2,一个命令按钮:Command1。要求建立这样的程序,使得当Command1被单击时,List1中被选中的项目移入到List2中。
需要详细的vb语言程序! 展开
展开全部
第一题:2种代码
vb.net版本
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a, b, c, d, x, y As Single
a = Val(TextBox1.Text)
b = Val(textbox2.text)
c = Val(textbox3.text)
d = Val(textbox4.text)
x = Val(textbox5.text)
y = a * x ^ 3 + b * x ^ 2 + c * x + d
label1.text=y
End Sub
===================================================
vb6.0 版本
Private Sub Command1_Click()
Text6.Text = JiSuan(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), Val(Text4.Text), Val(Text5.Text))
End Sub
Function JiSuan(a As Long, b As Long, c As Long, d As Long, x As Long) As Long
JiSuan = a * x ^ 3 + b * x ^ 2 + c * x + d
End Function
===================================
第二题
vb.net版本
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListBox1.Items.Add("1")
ListBox1.Items.Add("2")
ListBox1.Items.Add("3")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ListBox1.SelectedIndex > -1 Then
ListBox2.Items.Add(ListBox1.Text)
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
End If
End Sub
==========================
vb6.0版本
Private Sub Command1_Click()
If List1.ListIndex > -1 Then
List2.AddItem List1.Text
List1.RemoveItem List1.ListIndex
End If
End Sub
Private Sub Form_Load()
List1.AddItem "1"
List1.AddItem "2"
List1.AddItem "3"
End Sub
vb.net版本
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a, b, c, d, x, y As Single
a = Val(TextBox1.Text)
b = Val(textbox2.text)
c = Val(textbox3.text)
d = Val(textbox4.text)
x = Val(textbox5.text)
y = a * x ^ 3 + b * x ^ 2 + c * x + d
label1.text=y
End Sub
===================================================
vb6.0 版本
Private Sub Command1_Click()
Text6.Text = JiSuan(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), Val(Text4.Text), Val(Text5.Text))
End Sub
Function JiSuan(a As Long, b As Long, c As Long, d As Long, x As Long) As Long
JiSuan = a * x ^ 3 + b * x ^ 2 + c * x + d
End Function
===================================
第二题
vb.net版本
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListBox1.Items.Add("1")
ListBox1.Items.Add("2")
ListBox1.Items.Add("3")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ListBox1.SelectedIndex > -1 Then
ListBox2.Items.Add(ListBox1.Text)
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
End If
End Sub
==========================
vb6.0版本
Private Sub Command1_Click()
If List1.ListIndex > -1 Then
List2.AddItem List1.Text
List1.RemoveItem List1.ListIndex
End If
End Sub
Private Sub Form_Load()
List1.AddItem "1"
List1.AddItem "2"
List1.AddItem "3"
End Sub
展开全部
第一题:
Private Sub Command1_Click()
Dim a!, b!, c!, d!, x!
a = Text1.Text
b = Text2.Text
c = Text3.Text
d = Text4.Text
x = Text5.Text
Label1.Caption = f(a, b, c, d, x)
End Sub
Function f(a!, b!, c!, d!, x!)
f = a * x * x * x + b * x * x + c * x + d
End Function
第二题:
Private Sub Command1_Click()
List2.Clear '清除list2的内容
For i = 0 To List1.ListCount - 1
If List1.Selected(i) = True Then List2.AddItem List1.List(i) '添加list1中选中的项目
Next i
End Sub
Private Sub Command1_Click()
Dim a!, b!, c!, d!, x!
a = Text1.Text
b = Text2.Text
c = Text3.Text
d = Text4.Text
x = Text5.Text
Label1.Caption = f(a, b, c, d, x)
End Sub
Function f(a!, b!, c!, d!, x!)
f = a * x * x * x + b * x * x + c * x + d
End Function
第二题:
Private Sub Command1_Click()
List2.Clear '清除list2的内容
For i = 0 To List1.ListCount - 1
If List1.Selected(i) = True Then List2.AddItem List1.List(i) '添加list1中选中的项目
Next i
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询