frmkh.vb
上传用户:wj57717022
上传日期:2014-12-16
资源大小:4093k
文件大小:31k
- Imports localJxc.jxcmanage
- Public Class frmkh
- Inherits System.Windows.Forms.Form
- #Region " Windows 窗体设计器生成的代码 "
- Public Sub New()
- MyBase.New()
- '该调用是 Windows 窗体设计器所必需的。
- InitializeComponent()
- '在 InitializeComponent() 调用之后添加任何初始化
- End Sub
- '窗体重写 dispose 以清理组件列表。
- 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 tbrkh As System.Windows.Forms.ToolBar
- Friend WithEvents tbrAdd As System.Windows.Forms.ToolBarButton
- Friend WithEvents tbrSave As System.Windows.Forms.ToolBarButton
- Friend WithEvents tbrModify As System.Windows.Forms.ToolBarButton
- Friend WithEvents tbrDelete As System.Windows.Forms.ToolBarButton
- Friend WithEvents tbrPrint As System.Windows.Forms.ToolBarButton
- Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar
- Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
- Friend WithEvents Label8 As System.Windows.Forms.Label
- Friend WithEvents txtquery As System.Windows.Forms.TextBox
- Friend WithEvents btnQuery As System.Windows.Forms.Button
- Friend WithEvents tbrSeparator As System.Windows.Forms.ToolBarButton
- Friend WithEvents tbrExit As System.Windows.Forms.ToolBarButton
- Friend WithEvents MsdnTextboxValidator1 As MSDNTextboxValidator.MSDNTextboxValidator
- Friend WithEvents ErrorProvider1 As System.Windows.Forms.ErrorProvider
- Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
- Friend WithEvents txtLxr As System.Windows.Forms.TextBox
- Friend WithEvents txtSj As System.Windows.Forms.TextBox
- Friend WithEvents txtTele As System.Windows.Forms.TextBox
- Friend WithEvents txtAddress As System.Windows.Forms.TextBox
- Friend WithEvents cboXz As System.Windows.Forms.ComboBox
- Friend WithEvents txtNumber As System.Windows.Forms.TextBox
- Friend WithEvents txtName As System.Windows.Forms.TextBox
- Friend WithEvents Label7 As System.Windows.Forms.Label
- Friend WithEvents Label6 As System.Windows.Forms.Label
- Friend WithEvents Label5 As System.Windows.Forms.Label
- Friend WithEvents Label4 As System.Windows.Forms.Label
- Friend WithEvents Label3 As System.Windows.Forms.Label
- Friend WithEvents Label2 As System.Windows.Forms.Label
- Friend WithEvents Label1 As System.Windows.Forms.Label
- Friend WithEvents Panel1 As System.Windows.Forms.Panel
- Friend WithEvents dgkh As System.Windows.Forms.DataGrid
- Friend WithEvents ImageList2 As System.Windows.Forms.ImageList
- Friend WithEvents txtcustNumber As System.Windows.Forms.Label
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- Me.components = New System.ComponentModel.Container
- Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmkh))
- Me.tbrkh = New System.Windows.Forms.ToolBar
- Me.tbrAdd = New System.Windows.Forms.ToolBarButton
- Me.tbrSave = New System.Windows.Forms.ToolBarButton
- Me.tbrModify = New System.Windows.Forms.ToolBarButton
- Me.tbrDelete = New System.Windows.Forms.ToolBarButton
- Me.tbrPrint = New System.Windows.Forms.ToolBarButton
- Me.tbrSeparator = New System.Windows.Forms.ToolBarButton
- Me.tbrExit = New System.Windows.Forms.ToolBarButton
- Me.ImageList2 = New System.Windows.Forms.ImageList(Me.components)
- Me.StatusBar1 = New System.Windows.Forms.StatusBar
- Me.GroupBox2 = New System.Windows.Forms.GroupBox
- Me.btnQuery = New System.Windows.Forms.Button
- Me.txtquery = New System.Windows.Forms.TextBox
- Me.Label8 = New System.Windows.Forms.Label
- Me.MsdnTextboxValidator1 = New MSDNTextboxValidator.MSDNTextboxValidator(Me.components)
- Me.txtLxr = New System.Windows.Forms.TextBox
- Me.txtSj = New System.Windows.Forms.TextBox
- Me.txtTele = New System.Windows.Forms.TextBox
- Me.txtAddress = New System.Windows.Forms.TextBox
- Me.txtNumber = New System.Windows.Forms.TextBox
- Me.txtName = New System.Windows.Forms.TextBox
- Me.ErrorProvider1 = New System.Windows.Forms.ErrorProvider
- Me.GroupBox1 = New System.Windows.Forms.GroupBox
- Me.txtcustNumber = New System.Windows.Forms.Label
- Me.cboXz = New System.Windows.Forms.ComboBox
- 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.Panel1 = New System.Windows.Forms.Panel
- Me.dgkh = New System.Windows.Forms.DataGrid
- Me.GroupBox2.SuspendLayout()
- Me.GroupBox1.SuspendLayout()
- Me.Panel1.SuspendLayout()
- CType(Me.dgkh, System.ComponentModel.ISupportInitialize).BeginInit()
- Me.SuspendLayout()
- '
- 'tbrkh
- '
- Me.tbrkh.Appearance = System.Windows.Forms.ToolBarAppearance.Flat
- Me.tbrkh.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.tbrAdd, Me.tbrSave, Me.tbrModify, Me.tbrDelete, Me.tbrPrint, Me.tbrSeparator, Me.tbrExit})
- Me.tbrkh.DropDownArrows = True
- Me.tbrkh.ImageList = Me.ImageList2
- Me.tbrkh.Location = New System.Drawing.Point(0, 0)
- Me.tbrkh.Name = "tbrkh"
- Me.tbrkh.ShowToolTips = True
- Me.tbrkh.Size = New System.Drawing.Size(556, 41)
- Me.tbrkh.TabIndex = 0
- '
- 'tbrAdd
- '
- Me.tbrAdd.ImageIndex = 7
- Me.tbrAdd.Text = "添加"
- '
- 'tbrSave
- '
- Me.tbrSave.ImageIndex = 4
- Me.tbrSave.Text = "保存"
- '
- 'tbrModify
- '
- Me.tbrModify.ImageIndex = 5
- Me.tbrModify.Text = "修改"
- '
- 'tbrDelete
- '
- Me.tbrDelete.ImageIndex = 6
- Me.tbrDelete.Text = "删除"
- '
- 'tbrPrint
- '
- Me.tbrPrint.ImageIndex = 12
- Me.tbrPrint.Text = "打印"
- '
- 'tbrSeparator
- '
- Me.tbrSeparator.Style = System.Windows.Forms.ToolBarButtonStyle.Separator
- '
- 'tbrExit
- '
- Me.tbrExit.ImageIndex = 11
- Me.tbrExit.Text = "退出"
- '
- 'ImageList2
- '
- Me.ImageList2.ImageSize = New System.Drawing.Size(16, 16)
- Me.ImageList2.ImageStream = CType(resources.GetObject("ImageList2.ImageStream"), System.Windows.Forms.ImageListStreamer)
- Me.ImageList2.TransparentColor = System.Drawing.Color.Transparent
- '
- 'StatusBar1
- '
- Me.StatusBar1.Location = New System.Drawing.Point(0, 510)
- Me.StatusBar1.Name = "StatusBar1"
- Me.StatusBar1.Size = New System.Drawing.Size(556, 22)
- Me.StatusBar1.TabIndex = 2
- '
- 'GroupBox2
- '
- Me.GroupBox2.Controls.Add(Me.btnQuery)
- Me.GroupBox2.Controls.Add(Me.txtquery)
- Me.GroupBox2.Controls.Add(Me.Label8)
- Me.GroupBox2.Location = New System.Drawing.Point(0, 184)
- Me.GroupBox2.Name = "GroupBox2"
- Me.GroupBox2.Size = New System.Drawing.Size(557, 48)
- Me.GroupBox2.TabIndex = 4
- Me.GroupBox2.TabStop = False
- Me.GroupBox2.Text = "查询客户信息:"
- '
- 'btnQuery
- '
- Me.btnQuery.FlatStyle = System.Windows.Forms.FlatStyle.Popup
- Me.btnQuery.Location = New System.Drawing.Point(336, 16)
- Me.btnQuery.Name = "btnQuery"
- Me.btnQuery.Size = New System.Drawing.Size(80, 21)
- Me.btnQuery.TabIndex = 2
- Me.btnQuery.Text = "查询"
- '
- 'txtquery
- '
- Me.MsdnTextboxValidator1.SetCustomValidationEnabled(Me.txtquery, True)
- Me.MsdnTextboxValidator1.SetDataType(Me.txtquery, MSDNTextboxValidator.DataTypeConstants.StringType)
- Me.MsdnTextboxValidator1.SetDisplayName(Me.txtquery, "")
- Me.txtquery.Location = New System.Drawing.Point(168, 16)
- Me.MsdnTextboxValidator1.SetMaxValue(Me.txtquery, "")
- Me.MsdnTextboxValidator1.SetMinValue(Me.txtquery, "")
- Me.txtquery.Name = "txtquery"
- Me.MsdnTextboxValidator1.SetRegularExpression(Me.txtquery, "")
- Me.MsdnTextboxValidator1.SetRequired(Me.txtquery, False)
- Me.txtquery.Size = New System.Drawing.Size(161, 21)
- Me.txtquery.TabIndex = 1
- Me.txtquery.Text = ""
- '
- 'Label8
- '
- Me.Label8.AutoSize = True
- Me.Label8.Location = New System.Drawing.Point(12, 25)
- Me.Label8.Name = "Label8"
- Me.Label8.Size = New System.Drawing.Size(153, 17)
- Me.Label8.TabIndex = 0
- Me.Label8.Text = "请输入查询编号或拼音码:"
- '
- 'MsdnTextboxValidator1
- '
- Me.MsdnTextboxValidator1.DisplayControl = Nothing
- Me.MsdnTextboxValidator1.ErrorProvider = Nothing
- Me.MsdnTextboxValidator1.InvalidBackColor = System.Drawing.Color.Empty
- Me.MsdnTextboxValidator1.TooltipProvider = Nothing
- '
- 'txtLxr
- '
- Me.MsdnTextboxValidator1.SetCustomValidationEnabled(Me.txtLxr, True)
- Me.MsdnTextboxValidator1.SetDataType(Me.txtLxr, MSDNTextboxValidator.DataTypeConstants.StringType)
- Me.MsdnTextboxValidator1.SetDisplayName(Me.txtLxr, "")
- Me.txtLxr.Location = New System.Drawing.Point(66, 88)
- Me.MsdnTextboxValidator1.SetMaxValue(Me.txtLxr, "")
- Me.MsdnTextboxValidator1.SetMinValue(Me.txtLxr, "")
- Me.txtLxr.Name = "txtLxr"
- Me.MsdnTextboxValidator1.SetRegularExpression(Me.txtLxr, "")
- Me.MsdnTextboxValidator1.SetRequired(Me.txtLxr, False)
- Me.txtLxr.Size = New System.Drawing.Size(142, 21)
- Me.txtLxr.TabIndex = 13
- Me.txtLxr.Text = ""
- '
- 'txtSj
- '
- Me.MsdnTextboxValidator1.SetCustomValidationEnabled(Me.txtSj, True)
- Me.MsdnTextboxValidator1.SetDataType(Me.txtSj, MSDNTextboxValidator.DataTypeConstants.Int32Type)
- Me.MsdnTextboxValidator1.SetDisplayName(Me.txtSj, "")
- Me.txtSj.Location = New System.Drawing.Point(444, 56)
- Me.MsdnTextboxValidator1.SetMaxValue(Me.txtSj, "")
- Me.MsdnTextboxValidator1.SetMinValue(Me.txtSj, "")
- Me.txtSj.Name = "txtSj"
- Me.MsdnTextboxValidator1.SetRegularExpression(Me.txtSj, "")
- Me.MsdnTextboxValidator1.SetRequired(Me.txtSj, False)
- Me.txtSj.TabIndex = 12
- Me.txtSj.Text = ""
- '
- 'txtTele
- '
- Me.MsdnTextboxValidator1.SetCustomValidationEnabled(Me.txtTele, True)
- Me.MsdnTextboxValidator1.SetDataType(Me.txtTele, MSDNTextboxValidator.DataTypeConstants.StringType)
- Me.MsdnTextboxValidator1.SetDisplayName(Me.txtTele, "")
- Me.txtTele.Location = New System.Drawing.Point(270, 56)
- Me.MsdnTextboxValidator1.SetMaxValue(Me.txtTele, "")
- Me.MsdnTextboxValidator1.SetMinValue(Me.txtTele, "")
- Me.txtTele.Name = "txtTele"
- Me.MsdnTextboxValidator1.SetRegularExpression(Me.txtTele, "")
- Me.MsdnTextboxValidator1.SetRequired(Me.txtTele, False)
- Me.txtTele.Size = New System.Drawing.Size(102, 21)
- Me.txtTele.TabIndex = 11
- Me.txtTele.Text = ""
- '
- 'txtAddress
- '
- Me.MsdnTextboxValidator1.SetCustomValidationEnabled(Me.txtAddress, True)
- Me.MsdnTextboxValidator1.SetDataType(Me.txtAddress, MSDNTextboxValidator.DataTypeConstants.StringType)
- Me.MsdnTextboxValidator1.SetDisplayName(Me.txtAddress, "")
- Me.txtAddress.Location = New System.Drawing.Point(66, 56)
- Me.MsdnTextboxValidator1.SetMaxValue(Me.txtAddress, "")
- Me.MsdnTextboxValidator1.SetMinValue(Me.txtAddress, "")
- Me.txtAddress.Name = "txtAddress"
- Me.MsdnTextboxValidator1.SetRegularExpression(Me.txtAddress, "")
- Me.MsdnTextboxValidator1.SetRequired(Me.txtAddress, False)
- Me.txtAddress.Size = New System.Drawing.Size(142, 21)
- Me.txtAddress.TabIndex = 10
- Me.txtAddress.Text = ""
- '
- 'txtNumber
- '
- Me.MsdnTextboxValidator1.SetCustomValidationEnabled(Me.txtNumber, True)
- Me.MsdnTextboxValidator1.SetDataType(Me.txtNumber, MSDNTextboxValidator.DataTypeConstants.StringType)
- Me.MsdnTextboxValidator1.SetDisplayName(Me.txtNumber, "")
- Me.txtNumber.Location = New System.Drawing.Point(444, 25)
- Me.MsdnTextboxValidator1.SetMaxValue(Me.txtNumber, "")
- Me.MsdnTextboxValidator1.SetMinValue(Me.txtNumber, "")
- Me.txtNumber.Name = "txtNumber"
- Me.txtNumber.ReadOnly = True
- Me.MsdnTextboxValidator1.SetRegularExpression(Me.txtNumber, "")
- Me.MsdnTextboxValidator1.SetRequired(Me.txtNumber, False)
- Me.txtNumber.TabIndex = 9
- Me.txtNumber.Text = ""
- '
- 'txtName
- '
- Me.MsdnTextboxValidator1.SetCustomValidationEnabled(Me.txtName, True)
- Me.MsdnTextboxValidator1.SetDataType(Me.txtName, MSDNTextboxValidator.DataTypeConstants.StringType)
- Me.MsdnTextboxValidator1.SetDisplayName(Me.txtName, "")
- Me.txtName.Location = New System.Drawing.Point(66, 24)
- Me.MsdnTextboxValidator1.SetMaxValue(Me.txtName, "")
- Me.MsdnTextboxValidator1.SetMinValue(Me.txtName, "")
- Me.txtName.Name = "txtName"
- Me.MsdnTextboxValidator1.SetRegularExpression(Me.txtName, "")
- Me.MsdnTextboxValidator1.SetRequired(Me.txtName, False)
- Me.txtName.Size = New System.Drawing.Size(142, 21)
- Me.txtName.TabIndex = 7
- Me.txtName.Text = ""
- '
- 'ErrorProvider1
- '
- Me.ErrorProvider1.ContainerControl = Me
- '
- 'GroupBox1
- '
- Me.GroupBox1.Controls.Add(Me.txtcustNumber)
- Me.GroupBox1.Controls.Add(Me.txtLxr)
- Me.GroupBox1.Controls.Add(Me.txtSj)
- Me.GroupBox1.Controls.Add(Me.txtTele)
- Me.GroupBox1.Controls.Add(Me.txtAddress)
- Me.GroupBox1.Controls.Add(Me.cboXz)
- Me.GroupBox1.Controls.Add(Me.txtNumber)
- Me.GroupBox1.Controls.Add(Me.txtName)
- Me.GroupBox1.Controls.Add(Me.Label7)
- Me.GroupBox1.Controls.Add(Me.Label6)
- Me.GroupBox1.Controls.Add(Me.Label5)
- Me.GroupBox1.Controls.Add(Me.Label4)
- Me.GroupBox1.Controls.Add(Me.Label3)
- Me.GroupBox1.Controls.Add(Me.Label2)
- Me.GroupBox1.Controls.Add(Me.Label1)
- Me.GroupBox1.Dock = System.Windows.Forms.DockStyle.Top
- Me.GroupBox1.Location = New System.Drawing.Point(0, 41)
- Me.GroupBox1.Name = "GroupBox1"
- Me.GroupBox1.Size = New System.Drawing.Size(556, 136)
- Me.GroupBox1.TabIndex = 5
- Me.GroupBox1.TabStop = False
- Me.GroupBox1.Text = "添加客户信息"
- '
- 'txtcustNumber
- '
- Me.txtcustNumber.Location = New System.Drawing.Point(240, 96)
- Me.txtcustNumber.Name = "txtcustNumber"
- Me.txtcustNumber.TabIndex = 14
- '
- 'cboXz
- '
- Me.cboXz.Items.AddRange(New Object() {"供应商", "客户"})
- Me.cboXz.Location = New System.Drawing.Point(270, 24)
- Me.cboXz.Name = "cboXz"
- Me.cboXz.Size = New System.Drawing.Size(102, 20)
- Me.cboXz.TabIndex = 8
- '
- 'Label7
- '
- Me.Label7.AutoSize = True
- Me.Label7.Location = New System.Drawing.Point(24, 96)
- Me.Label7.Name = "Label7"
- Me.Label7.Size = New System.Drawing.Size(54, 17)
- Me.Label7.TabIndex = 6
- Me.Label7.Text = "联系人:"
- '
- 'Label6
- '
- Me.Label6.AutoSize = True
- Me.Label6.Location = New System.Drawing.Point(414, 62)
- Me.Label6.Name = "Label6"
- Me.Label6.Size = New System.Drawing.Size(42, 17)
- Me.Label6.TabIndex = 5
- Me.Label6.Text = "手机:"
- '
- 'Label5
- '
- Me.Label5.AutoSize = True
- Me.Label5.Location = New System.Drawing.Point(240, 64)
- Me.Label5.Name = "Label5"
- Me.Label5.Size = New System.Drawing.Size(42, 17)
- Me.Label5.TabIndex = 4
- Me.Label5.Text = "电话:"
- '
- 'Label4
- '
- Me.Label4.AutoSize = True
- Me.Label4.Location = New System.Drawing.Point(36, 64)
- Me.Label4.Name = "Label4"
- Me.Label4.Size = New System.Drawing.Size(42, 17)
- Me.Label4.TabIndex = 3
- Me.Label4.Text = "地址:"
- '
- 'Label3
- '
- Me.Label3.AutoSize = True
- Me.Label3.Location = New System.Drawing.Point(240, 32)
- Me.Label3.Name = "Label3"
- Me.Label3.Size = New System.Drawing.Size(42, 17)
- Me.Label3.TabIndex = 2
- Me.Label3.Text = "性质:"
- '
- 'Label2
- '
- Me.Label2.AutoSize = True
- Me.Label2.Location = New System.Drawing.Point(12, 32)
- Me.Label2.Name = "Label2"
- Me.Label2.Size = New System.Drawing.Size(66, 17)
- Me.Label2.TabIndex = 1
- Me.Label2.Text = "客户名称:"
- '
- 'Label1
- '
- Me.Label1.AutoSize = True
- Me.Label1.Location = New System.Drawing.Point(390, 31)
- Me.Label1.Name = "Label1"
- Me.Label1.Size = New System.Drawing.Size(66, 17)
- Me.Label1.TabIndex = 0
- Me.Label1.Text = "客户编号:"
- '
- 'Panel1
- '
- Me.Panel1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
- Or System.Windows.Forms.AnchorStyles.Left) _
- Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
- Me.Panel1.Controls.Add(Me.dgkh)
- Me.Panel1.Location = New System.Drawing.Point(0, 240)
- Me.Panel1.Name = "Panel1"
- Me.Panel1.Size = New System.Drawing.Size(557, 264)
- Me.Panel1.TabIndex = 6
- '
- 'dgkh
- '
- Me.dgkh.DataMember = ""
- Me.dgkh.Dock = System.Windows.Forms.DockStyle.Fill
- Me.dgkh.HeaderForeColor = System.Drawing.SystemColors.ControlText
- Me.dgkh.Location = New System.Drawing.Point(0, 0)
- Me.dgkh.Name = "dgkh"
- Me.dgkh.Size = New System.Drawing.Size(557, 264)
- Me.dgkh.TabIndex = 4
- '
- 'frmkh
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
- Me.ClientSize = New System.Drawing.Size(556, 532)
- Me.Controls.Add(Me.Panel1)
- Me.Controls.Add(Me.GroupBox1)
- Me.Controls.Add(Me.GroupBox2)
- Me.Controls.Add(Me.StatusBar1)
- Me.Controls.Add(Me.tbrkh)
- Me.HelpButton = True
- Me.Name = "frmkh"
- Me.Text = "客户基本信息"
- Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
- Me.GroupBox2.ResumeLayout(False)
- Me.GroupBox1.ResumeLayout(False)
- Me.Panel1.ResumeLayout(False)
- CType(Me.dgkh, System.ComponentModel.ISupportInitialize).EndInit()
- Me.ResumeLayout(False)
- End Sub
- #End Region
- Public lsweb As New jxcmanage
- Public dslocals As DataSet = lsweb.returndataset("select * from wz_kh", "wz_kh")
- Private Sub frmkh_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- dslocals.Clear()
- dgkh.DataSource = dslocals.Tables("wz_kh").DefaultView
- End Sub
- Private Sub save()
- dslocals = lsweb.returndataset("select * from wz_kh", "wz_kh")
- Dim dr As DataRow = dslocals.Tables(0).NewRow()
- dr("客户编号") = txtNumber.Text.Trim
- dr("客户名称") = txtName.Text.Trim
- dr("性质") = cboXz.Text.Trim
- dr("地址") = txtAddress.Text.Trim
- dr("电话") = txtTele.Text.Trim
- dr("手机") = txtSj.Text.Trim
- dr("联系人") = txtLxr.Text.Trim
- dr("应收帐款") = 0
- dr("应付帐款") = 0
- dr("余额") = 0
- dslocals.Tables(0).Rows.Add(dr)
- If lsweb.updatedataset("select * from wz_kh", "wz_kh", dslocals, DataRowState.Added) = True Then
- MessageBox.Show("客户信息成功保存!", "提示", MessageBoxButtons.OK)
- Else
- MessageBox.Show("客户信息保存失败!", "提示", MessageBoxButtons.AbortRetryIgnore)
- End If
- End Sub
- Private Sub modify()
- If lsweb.updatekh(txtcustNumber.Text, txtName.Text, cboXz.Text, txtAddress.Text, txtTele.Text, txtSj.Text, txtLxr.Text) = True Then
- MessageBox.Show("客户信息修改成功!", "提示", MessageBoxButtons.OK)
- Else
- MessageBox.Show("客户信息修改失败!", "提示", MessageBoxButtons.OK)
- End If
- End Sub
- Private Sub add()
- txtName.Focus()
- txtNumber.Text = "".Trim()
- txtName.Text = "".Trim()
- cboXz.Text = "".Trim()
- txtAddress.Text = "".Trim()
- txtTele.Text = "".Trim()
- txtSj.Text = "".Trim()
- txtLxr.Text = "".Trim()
- End Sub
- Private Sub print()
- If txtquery.Text = String.Empty Then
- MessageBox.Show("没有要打印的记录!", "提示", MessageBoxButtons.OK)
- Else
- Dim frmviewkher As New frmviewkh
- frmviewkher.strquery = lsweb.getinfoes(txtquery.Text)
- frmviewkher.Show()
- End If
- End Sub
- Private Sub btnQuery_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuery.Click
- If txtquery.Text = "" Then
- dslocals = lsweb.returndataset("select * from wz_kh", "wz_kh")
- dgkh.DataSource = dslocals.Tables("wz_kh").DefaultView
- Else
- dslocals = lsweb.returndataset("select * from wz_kh where 客户编号 like '%" & txtquery.Text.Trim & "%' or 拼音码 like '%" & txtquery.Text.Trim & "%'", "wz_kh")
- dgkh.DataSource = dslocals.Tables("wz_kh").DefaultView
- End If
- End Sub
- Private Sub delete()
- Dim drv As DataRowView = BindingContext(Me.dgkh.DataSource).Current
- If drv(0) Is System.DBNull.Value Then
- MessageBox.Show("没有要删除的记录!", "提示", MessageBoxButtons.OK)
- Else
- Dim strquery As String = drv(0)
- If lsweb.deletekh(strquery) = True Then
- MessageBox.Show("已经删除记录啦!", "提示", MessageBoxButtons.OK)
- Else
- MessageBox.Show("删除记录失败!", "提示", MessageBoxButtons.OK)
- End If
- End If
- End Sub
- Private Sub view()
- Dim drv As DataRowView = BindingContext(Me.dgkh.DataSource).Current
- Dim dr As DataRow
- dr = drv.Row
- txtcustNumber.Text = IIf(dr("客户编号") Is System.DBNull.Value, "", dr("客户编号"))
- txtNumber.Text = IIf(dr("客户编号") Is System.DBNull.Value, "", dr("客户编号"))
- txtName.Text = IIf(dr("客户名称") Is System.DBNull.Value, "", dr("客户名称"))
- cboXz.Text = IIf(dr("性质") Is System.DBNull.Value, "", dr("性质"))
- txtAddress.Text = IIf(dr("地址") Is System.DBNull.Value, "", dr("地址"))
- txtTele.Text = IIf(dr("电话") Is System.DBNull.Value, "", dr("电话"))
- txtSj.Text = IIf(dr("手机") Is System.DBNull.Value, "", dr("手机"))
- txtLxr.Text = IIf(dr("联系人") Is System.DBNull.Value, "", dr("联系人"))
- End Sub
- Private Sub tbrkh_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tbrkh.ButtonClick
- Select Case e.Button.Text
- Case "添加"
- add()
- tbnEnable("tbrAdd.Enabled = False", tbrkh)
- dslocals.Clear()
- dgkh.DataSource = dslocals.Tables("wz_kh").DefaultView
- Case "保存"
- If txtName.Text = "" Or txtNumber.Text = "" Or cboXz.Text = "" Or txtAddress.Text = "" Or txtTele.Text = "" Or txtSj.Text = "" Or txtLxr.Text = "" Then
- MessageBox.Show("信息不完整,保存失败!", "提示", MessageBoxButtons.OK)
- Else
- save()
- tbnEnable("tbrSave.Enabled = False", tbrkh)
- End If
-
- Case "修改"
- modify()
- tbnEnable("tbrModify.Enabled = False", tbrkh)
- Case "删除"
- delete()
- tbnEnable("tbrDelete.Enabled = False", tbrkh)
- Case "打印"
- print()
- Case "退出"
- Me.Close()
- End Select
- End Sub
- Public Sub tbnEnable(ByVal strboolean As String, ByVal tbr As ToolBar)
- If strboolean = "tbrAdd.Enabled = True" Then
- tbrSave.Enabled = False
- tbrModify.Enabled = False
- tbrDelete.Enabled = False
- tbrPrint.Enabled = False
- tbrExit.Enabled = True
- ElseIf strboolean = "tbrAdd.Enabled = False" Then
- tbrAdd.Enabled = False
- tbrSave.Enabled = True
- tbrModify.Enabled = False
- tbrDelete.Enabled = False
- tbrPrint.Enabled = True
- tbrExit.Enabled = True
- ElseIf strboolean = "tbrSave.Enabled = True" Then
- tbrAdd.Enabled = False
- tbrModify.Enabled = False
- tbrDelete.Enabled = False
- tbrPrint.Enabled = True
- tbrExit.Enabled = True
- ElseIf strboolean = "tbrSave.Enabled = False" Then
- tbrSave.Enabled = False
- tbrAdd.Enabled = True
- tbrModify.Enabled = True
- tbrDelete.Enabled = True
- tbrPrint.Enabled = True
- tbrExit.Enabled = True
- ElseIf strboolean = "tbrModify.Enabled = True" Then
- tbrAdd.Enabled = False
- tbrSave.Enabled = True
- tbrDelete.Enabled = False
- tbrPrint.Enabled = False
- tbrExit.Enabled = True
- ElseIf strboolean = "tbrModify.Enabled = False" Then
- tbrModify.Enabled = False
- tbrAdd.Enabled = False
- tbrSave.Enabled = True
- tbrDelete.Enabled = False
- tbrPrint.Enabled = True
- tbrExit.Enabled = True
- ElseIf strboolean = "tbrDelete.Enabled = True" Then
- tbrAdd.Enabled = False
- tbrSave.Enabled = True
- tbrModify.Enabled = False
- tbrPrint.Enabled = False
- tbrExit.Enabled = True
- ElseIf strboolean = "tbrDelete.Enabled = False" Then
- tbrDelete.Enabled = False
- tbrAdd.Enabled = False
- tbrSave.Enabled = True
- tbrModify.Enabled = False
- tbrPrint.Enabled = False
- tbrExit.Enabled = True
- End If
- End Sub
- Private Sub cboXz_SelectedIndexChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboXz.SelectedIndexChanged
- Dim webserver As New jxcmanage
- If cboXz.Text = "供应商" Then
- Dim number As Integer
- number = webserver.maxkhint("G") + 1
- txtNumber.Text = "G" & Format(number, "0000")
- ElseIf cboXz.Text = "客户" Then
- Dim number As Integer
- number = webserver.maxkhint("K") + 1
- txtNumber.Text = "K" & Format(number, "0000")
- ElseIf cboXz.Text = "其他" Then
- Dim number As Integer
- number = webserver.maxkhint("Q") + 1
- txtNumber.Text = "Q" & Format(number, "0000")
- End If
- End Sub
- Private Sub dgkh_CurrentCellChanged1(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgkh.CurrentCellChanged
- view()
- tbrModify.Enabled = True
- tbrDelete.Enabled = True
- tbrPrint.Enabled = True
- tbrExit.Enabled = True
- End Sub
- Private Sub txtName_KeyDown1(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtName.KeyDown
- If e.KeyCode = Keys.Enter Then
- cboXz.Focus()
- End If
- End Sub
- Private Sub cboXz_KeyDown1(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles cboXz.KeyDown
- If e.KeyCode = Keys.Enter Then
- txtAddress.Focus()
- End If
- End Sub
- Private Sub txtAddress_KeyDown1(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtAddress.KeyDown
- If e.KeyCode = Keys.Enter Then
- txtTele.Focus()
- End If
- End Sub
- Private Sub txtTele_KeyDown1(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtTele.KeyDown
- If e.KeyCode = Keys.Enter Then
- txtSj.Focus()
- End If
- End Sub
- Private Sub txtSj_KeyDown1(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtSj.KeyDown
- If e.KeyCode = Keys.Enter Then
- txtLxr.Focus()
- End If
- End Sub
- Private Sub txtName_Validating1(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtName.Validating
- If txtName.Text = String.Empty Then
- ErrorProvider1.SetError(txtName, "不能为空,请输入客户名称!")
- txtName.Focus()
- Else
- ErrorProvider1.SetError(txtName, "")
- End If
- End Sub
- Private Sub cboXz_Validating1(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles cboXz.Validating
- If cboXz.Text = String.Empty Then
- ErrorProvider1.SetError(cboXz, "不能为空,请选择下拉列表!")
- cboXz.Focus()
- Else
- ErrorProvider1.SetError(cboXz, "")
- End If
- End Sub
- Private Sub txtAddress_Validating1(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtAddress.Validating
- If txtAddress.Text = String.Empty Then
- ErrorProvider1.SetError(txtAddress, "不能为空,请输入地址!")
- txtAddress.Focus()
- Else
- ErrorProvider1.SetError(txtAddress, "")
- End If
- End Sub
- Private Sub txtTele_Validating1(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtTele.Validating
- If txtTele.Text = String.Empty Then
- ErrorProvider1.SetError(txtTele, "不能为空,请输入电话!")
- txtTele.Focus()
- Else
- ErrorProvider1.SetError(txtTele, "")
- End If
- End Sub
- Private Sub txtSj_Validating1(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtSj.Validating
- If txtSj.Text = String.Empty Then
- ErrorProvider1.SetError(txtSj, "不能为空,请输入手机号码!")
- txtSj.Focus()
- Else
- ErrorProvider1.SetError(txtSj, "")
- End If
- End Sub
- Private Sub txtLxr_Validating1(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtLxr.Validating
- If txtLxr.Text = String.Empty Then
- ErrorProvider1.SetError(txtLxr, "不能为空,请输入联系人!")
- txtLxr.Focus()
- Else
- ErrorProvider1.SetError(txtLxr, "")
- End If
- End Sub
-
- Private Sub txtName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtName.TextChanged
- End Sub
- End Class