⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmb.vb

📁 需要在.net环境下运行需要安装框架
💻 VB
字号:
Public Class FRMB
    Inherits System.Windows.Forms.Form

#Region " Windows 窗体设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        '该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加任何初始化

    End Sub

    '窗体重写处置以清理组件列表。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Windows 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意:以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改此过程。
    '不要使用代码编辑器修改它。
    Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents tbHOName As System.Windows.Forms.TextBox
    Friend WithEvents tbHOTel As System.Windows.Forms.TextBox
    Friend WithEvents tbHORemark As System.Windows.Forms.TextBox
    Friend WithEvents cbHOSex As System.Windows.Forms.ComboBox
    Friend WithEvents tbHOAddress As System.Windows.Forms.TextBox
    Friend WithEvents btnBuy As System.Windows.Forms.Button
    Friend WithEvents btnFamily As System.Windows.Forms.Button
    Friend WithEvents nudHID As System.Windows.Forms.NumericUpDown
    Friend WithEvents DG As System.Windows.Forms.DataGrid
    Friend WithEvents tbHOIDCard As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.DG = New System.Windows.Forms.DataGrid()
        Me.GroupBox2 = New System.Windows.Forms.GroupBox()
        Me.nudHID = New System.Windows.Forms.NumericUpDown()
        Me.tbHOAddress = New System.Windows.Forms.TextBox()
        Me.cbHOSex = New System.Windows.Forms.ComboBox()
        Me.tbHORemark = New System.Windows.Forms.TextBox()
        Me.tbHOTel = New System.Windows.Forms.TextBox()
        Me.tbHOIDCard = New System.Windows.Forms.TextBox()
        Me.tbHOName = New System.Windows.Forms.TextBox()
        Me.Label7 = New System.Windows.Forms.Label()
        Me.Label6 = New System.Windows.Forms.Label()
        Me.Label5 = New System.Windows.Forms.Label()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.btnBuy = New System.Windows.Forms.Button()
        Me.btnFamily = New System.Windows.Forms.Button()
        CType(Me.DG, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.GroupBox2.SuspendLayout()
        CType(Me.nudHID, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'DG
        '
        Me.DG.DataMember = ""
        Me.DG.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.DG.Location = New System.Drawing.Point(8, 264)
        Me.DG.Name = "DG"
        Me.DG.Size = New System.Drawing.Size(480, 128)
        Me.DG.TabIndex = 1
        '
        'GroupBox2
        '
        Me.GroupBox2.Controls.AddRange(New System.Windows.Forms.Control() {Me.nudHID, Me.tbHOAddress, Me.cbHOSex, Me.tbHORemark, Me.tbHOTel, Me.tbHOIDCard, Me.tbHOName, Me.Label7, Me.Label6, Me.Label5, Me.Label4, Me.Label3, Me.Label2, Me.Label1})
        Me.GroupBox2.Location = New System.Drawing.Point(8, 48)
        Me.GroupBox2.Name = "GroupBox2"
        Me.GroupBox2.Size = New System.Drawing.Size(480, 208)
        Me.GroupBox2.TabIndex = 2
        Me.GroupBox2.TabStop = False
        Me.GroupBox2.Text = "个人资料"
        '
        'nudHID
        '
        Me.nudHID.Location = New System.Drawing.Point(320, 17)
        Me.nudHID.Maximum = New Decimal(New Integer() {10000, 0, 0, 0})
        Me.nudHID.Name = "nudHID"
        Me.nudHID.Size = New System.Drawing.Size(152, 21)
        Me.nudHID.TabIndex = 14
        '
        'tbHOAddress
        '
        Me.tbHOAddress.Location = New System.Drawing.Point(320, 88)
        Me.tbHOAddress.Name = "tbHOAddress"
        Me.tbHOAddress.Size = New System.Drawing.Size(152, 21)
        Me.tbHOAddress.TabIndex = 13
        Me.tbHOAddress.Text = ""
        '
        'cbHOSex
        '
        Me.cbHOSex.Items.AddRange(New Object() {"男", "女"})
        Me.cbHOSex.Location = New System.Drawing.Point(320, 52)
        Me.cbHOSex.Name = "cbHOSex"
        Me.cbHOSex.Size = New System.Drawing.Size(152, 20)
        Me.cbHOSex.TabIndex = 12
        Me.cbHOSex.Text = "男"
        '
        'tbHORemark
        '
        Me.tbHORemark.Location = New System.Drawing.Point(8, 144)
        Me.tbHORemark.Multiline = True
        Me.tbHORemark.Name = "tbHORemark"
        Me.tbHORemark.Size = New System.Drawing.Size(464, 56)
        Me.tbHORemark.TabIndex = 10
        Me.tbHORemark.Text = ""
        '
        'tbHOTel
        '
        Me.tbHOTel.Location = New System.Drawing.Point(88, 88)
        Me.tbHOTel.Name = "tbHOTel"
        Me.tbHOTel.Size = New System.Drawing.Size(120, 21)
        Me.tbHOTel.TabIndex = 9
        Me.tbHOTel.Text = ""
        '
        'tbHOIDCard
        '
        Me.tbHOIDCard.Location = New System.Drawing.Point(88, 52)
        Me.tbHOIDCard.Name = "tbHOIDCard"
        Me.tbHOIDCard.Size = New System.Drawing.Size(120, 21)
        Me.tbHOIDCard.TabIndex = 8
        Me.tbHOIDCard.Text = ""
        '
        'tbHOName
        '
        Me.tbHOName.Location = New System.Drawing.Point(88, 16)
        Me.tbHOName.Name = "tbHOName"
        Me.tbHOName.Size = New System.Drawing.Size(120, 21)
        Me.tbHOName.TabIndex = 7
        Me.tbHOName.Text = ""
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(224, 18)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(72, 16)
        Me.Label7.TabIndex = 6
        Me.Label7.Text = "房号:"
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(8, 120)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(72, 16)
        Me.Label6.TabIndex = 5
        Me.Label6.Text = "备注:"
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(224, 90)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(72, 16)
        Me.Label5.TabIndex = 4
        Me.Label5.Text = "联系地址:"
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(8, 90)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(72, 16)
        Me.Label4.TabIndex = 3
        Me.Label4.Text = "电话:"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(224, 54)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(72, 16)
        Me.Label3.TabIndex = 2
        Me.Label3.Text = "性别:"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(8, 54)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(72, 16)
        Me.Label2.TabIndex = 1
        Me.Label2.Text = "身份证:"
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(8, 18)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(72, 16)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "姓名:"
        '
        'btnBuy
        '
        Me.btnBuy.Location = New System.Drawing.Point(16, 16)
        Me.btnBuy.Name = "btnBuy"
        Me.btnBuy.Size = New System.Drawing.Size(80, 24)
        Me.btnBuy.TabIndex = 3
        Me.btnBuy.Text = "买房"
        '
        'btnFamily
        '
        Me.btnFamily.Location = New System.Drawing.Point(400, 16)
        Me.btnFamily.Name = "btnFamily"
        Me.btnFamily.Size = New System.Drawing.Size(80, 24)
        Me.btnFamily.TabIndex = 4
        Me.btnFamily.Text = "家庭成员"
        '
        'FRMB
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(496, 397)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnFamily, Me.GroupBox2, Me.DG, Me.btnBuy})
        Me.Name = "FRMB"
        Me.Text = "FRMB"
        CType(Me.DG, System.ComponentModel.ISupportInitialize).EndInit()
        Me.GroupBox2.ResumeLayout(False)
        CType(Me.nudHID, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub FRMB_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '将没有买出去的房屋的信息全部显示出来。
        Dim sqlStr As String
        sqlStr = "select * from house where hSold='否'"
        Dim dbopera1 As DbOpera = New DbOpera(sqlStr)
        DG.DataSource = dbopera1.getDG().DataSource
        DG.NavigateTo(0, "marvin")
    End Sub

    Private Function check() As Boolean
        If tbHOName.Text = "" Or nudHID.Text = "" Or tbHOIDCard.Text = "" Then
            MsgBox("请填入必要的信息!", MsgBoxStyle.Exclamation, "OK")
            check = False
        Else
            check = True
        End If
    End Function
    Private Sub btnBuy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBuy.Click
        '买房
        '验证客户所要购买的房屋还没有卖出,并且计算出他要出的价钱。
        If Not check() Then
            Exit Sub
        End If
        Dim sqlStr1 As String
        sqlStr1 = "select hPrice from house where hSold='否' and hID=" & nudHID.Text
        Dim dbopera1 As DbOpera = New DbOpera(sqlStr1) '房价
        Dim sum As Integer = dbopera1.getSum()
        Dim sqlStr2 As String = "select iManageCost from information " '计算管理费用,把管理费用折算到用户欠款中
        Dim dbopera2 As DbOpera = New DbOpera(sqlStr2)
        Dim iM1 As Integer = Date.DaysInMonth(Date.Today.Year, Date.Today.Month)
        Dim iM2 As Integer = Date.Today.Day
        Dim iM As Integer = Int(dbopera2.getSum() * iM2 / iM1)
        If sum = 0 Then '表明没有符合条件的值() 
            MsgBox("你提供的房号可能已出售或者不存在。", MsgBoxStyle.Exclamation, "OK")
            Exit Sub
        Else
            If MsgBox("你应该支付:" & sum.ToString() & "元", MsgBoxStyle.YesNo, "OK") = MsgBoxResult.No Then
                MsgBox("下次再见!", MsgBoxStyle.Exclamation, "OK")
                Exit Sub
            End If
        End If
        '插入户主表,更改房屋使用信息
        iM1 = Date.Today.Month
        iM2 = Date.Today.Year
        Dim hoCostDate As String = iM2.ToString() & "年" & iM1.ToString() & "月"
        Dim sqlStr As String
        sqlStr = "insert into houseOwner(hoName,hID,hoIDCard,hoSex,hoTel,hoRemark,hoCostDate,hoMoney) values('"
        sqlStr = sqlStr & tbHOName.Text & "',"
        sqlStr = sqlStr & nudHID.Text & ",'"
        sqlStr = sqlStr & tbHOIDCard.Text & "','"
        sqlStr = sqlStr & cbHOSex.Text & "','"
        sqlStr = sqlStr & tbHOTel.Text & "','"
        sqlStr = sqlStr & tbHORemark.Text & "','"
        sqlStr = sqlStr & hoCostDate & "',"
        sqlStr = sqlStr & iM.ToString() & ")"
        Dim dbopera3 As DbOpera = New DbOpera(sqlStr)
        If Not dbopera3.opera() Then
            Exit Sub
        End If
        Dim sqlStr4 As String
        sqlStr4 = "update house set hoName='" & tbHOName.Text & "', hSold='是'" & " where hID=" & nudHID.Text
        Dim dbopera4 As DbOpera = New DbOpera(sqlStr4)
        dbopera4.opera()
        MsgBox("成功!", MsgBoxStyle.Exclamation, "OK")
        '更新显示的房屋信息
        Dim sqlStr5 As String
        sqlStr5 = "select * from house where hSold='否'"
        Dim dbopera5 As DbOpera = New DbOpera(sqlStr5)
        DG.DataSource = dbopera5.getDG().DataSource
        '加入新的电费和水费记录
        Dim sqlStr6 As String = "insert into waterCost(hID) values(" & nudHID.Text & ")"
        Dim dbopera6 As DbOpera = New DbOpera(sqlStr6)
        dbopera6.opera()
        Dim sqlStr7 As String = "insert into eletrityCost(hID) values(" & nudHID.Text & ")"
        Dim dbopera7 As DbOpera = New DbOpera(sqlStr7)
        dbopera7.opera()
    End Sub

    Private Sub btnFamily_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFamily.Click
        Dim fmf As FRMFA = New FRMFA()
        fmf.ShowDialog()
    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -