vb实现二元一次复数方程求解

Public Class MainForm Dim a,b,c,d,e1,f,g,h,k1,k1i,k2,k2i,x1,x2,y1,y2 As Single Dim D_,D1,D2,D3,D4 As Single Private Sub Form1_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles MyBase.Load txt_a.Text = "3" txt_b.Text = "2" txt_c.Text = "5" txt_d.Text = "1" txt_k1.Text = "10" txt_k1i.Text = "0" txt_e.Text = "5" txt_f.Text = "2" txt_g.Text = "3" txt_h.Text = "4" txt_k2.Text = "5" txt_k2i.Text = "0" End Sub Private Sub 退出ToolStripMenuItem_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles 退出ToolStripMenuItem.Click Dim strExit As String strExit = "您确定要停止运行吗?" If vbNo = MsgBox(strExit,vbQuestion Or vbYesNo,"") Then Exit Sub End If End End Sub Private Sub Button_Clean_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button_Clean.Click clean() End Sub Private Sub Button_run_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button_run.Click If (txt_a.Text <> "" And txt_b.Text <> "" And txt_c.Text <> "" And txt_d.Text <> "" And txt_k1.Text <> "" And txt_k1i.Text <> "" And txt_e.Text <> "" And txt_f.Text <> "" And txt_g.Text <> "" And txt_h.Text <> "" And txt_k2.Text <> "" And txt_k2i.Text <> "") Then Call MsgBox("参数正常!",vbExclamation,"提示") Try a = Val(txt_a.Text) b = Val(txt_b.Text) c = Val(txt_c.Text) d = Val(txt_d.Text) k1 = Val(txt_k1.Text) k1i = Val(txt_k1i.Text) e1 = Val(txt_e.Text) f = Val(txt_f.Text) g = Val(txt_g.Text) h = Val(txt_h.Text) k2 = Val(txt_k2.Text) k2i = Val(txt_k2i.Text) Catch Call MsgBox("参数输入失败,请输入数字!","提示") End Try Try D_ = sijiehanglieshijishuan(a,-b,-f,-h,a,g) D1 = sijiehanglieshijishuan(k1,-d,g) D2 = sijiehanglieshijishuan(a,g) D3 = sijiehanglieshijishuan(a,g) D4 = sijiehanglieshijishuan(a,0) x1 = D1 / d x2 = D2 / d y1 = D3 / d y2 = D4 / d lab_x1.Text = x1 lab_x2.Text = x2 lab_y1.Text = y1 lab_y2.Text = y2 'lab_tip.Text = Val("D=" + D_ + "**D1=" + D1 + "**D2=" + D2 + "**D3=" + D3 + "**D1=" + D4 + "**D1=" + D4) Catch ex As Exception Call MsgBox("计算出错抛出,请确认参数正确!","提示") lab_x1.Text = "" lab_x2.Text = "" lab_y1.Text = "" lab_y2.Text = "" End Try Else Call MsgBox("参数不正常。","提示") End If End Sub Private Sub clean() txt_a.Text = "" txt_b.Text = "" txt_c.Text = "" txt_d.Text = "" txt_k1.Text = "" txt_k1i.Text = "" txt_e.Text = "" txt_f.Text = "" txt_g.Text = "" txt_h.Text = "" txt_k2.Text = "" txt_k2i.Text = "" lab_x1.Text = "" lab_x2.Text = "" lab_y1.Text = "" lab_y2.Text = "" Call MsgBox("清除参数。","提示") End Sub Private Function sijiehanglieshijishuan(ByVal A11 As Single,ByVal A12 As Single,ByVal A13 As Single,ByVal A14 As Single,ByVal A21 As Single,ByVal A22 As Single,ByVal A23 As Single,ByVal A24 As Single,ByVal A31 As Single,ByVal A32 As Single,ByVal A33 As Single,ByVal A34 As Single,ByVal A41 As Single,ByVal A42 As Single,ByVal A43 As Single,ByVal A44 As Single) Dim jiguo As Single Try jiguo = A11 * A22 * A33 * A44 - A11 * A22 * A34 * A43 - A11 * A23 * A32 * A44 + A11 * A23 * A34 * A42 + A11 * A24 * A32 * A43 - A11 * A24 * A33 * A42 - A12 * A21 * A33 * A44 + A12 * A21 * A34 * A43 + A12 * A23 * A31 * A44 - A12 * A23 * A34 * A41 - A12 * A24 * A31 * A43 + A12 * A24 * A33 * A41 + A13 * A21 * A32 * A44 - A13 * A21 * A34 * A42 - A13 * A22 * A31 * A44 + A13 * A22 * A34 * A41 + A13 * A24 * A31 * A42 - A13 * A24 * A32 * A41 - A14 * A21 * A32 * A43 + A14 * A21 * A33 * A42 - A14 * A22 * A31 * A43 - A14 * A22 * A33 * A41 - A14 * A23 * A31 * A42 + A14 * A23 * A32 * A41 Catch ex As Exception End Try Return jiguo End Function Private Sub 重置所有参数ToolStripMenuItem_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles 重置所有参数ToolStripMenuItem.Click clean() End Sub Private Sub 联系作者ToolStripMenuItem_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles 联系作者ToolStripMenuItem.Click Call MsgBox("作者QQ:389465553,广石化短号:620319","提示") End Sub End Class

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As Dat...