第一范文网 - 专业文章范例文档资料分享平台

VB实例源码 

来源:用户分享 时间:2025/5/29 12:10:14 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

End If

If Combo1.Text = \

MsgBox \请选择货源地!\ Combo1.SetFocus Exit Sub End If

If comboy.Text = \

MsgBox \请选择年份!\ comboy.SetFocus Exit Sub End If

If combom.Text = \

MsgBox \请选择月份!\ combom.SetFocus Exit Sub End If

If combod.Text = \

MsgBox \请选择日期!\ combod.SetFocus Exit Sub End If

If Text2.Text = \

MsgBox \请填写凭证号!\ Text2.SetFocus Exit Sub End If

If Text3.Text = \

MsgBox \请填写经手人!\ Text3.SetFocus Exit Sub End If

If MSFlexGrid1.Col <> 0 Then

MsgBox \请输入完整的物品信息!\ MSFlexGrid1.SetFocus Exit Sub End If

sql = \出入库 where 货单号='\rs_save.Open sql, conn, adOpenKeyset, adLockPessimistic If rs_save.EOF Then rs_save.AddNew

rs_save.Fields(0) = Trim(Text1.Text)

rs_save.Fields(1) = CDate(Trim(comboy.Text) & \& Trim(combom.Text) & \& Trim(combod.Text))

rs_save.Fields(2) = Trim(Combo1.Text)

46

rs_save.Fields(3) = Trim(Text2.Text) rs_save.Fields(4) = Trim(Text3.Text) rs_save.Fields(5) = Trim(Text4.Text)

If crk1.Caption = \入库\ '出入库标记 rs_save.Fields(6) = True Else

rs_save.Fields(6) = False End If

rs_save.Update rs_save.Close Else

MsgBox \货单号重复!\ Text1.SetFocus Text1.Text = \ rs_save.Close Exit Sub End If

sql = \货物明细\

rs_save.Open sql, conn, adOpenKeyset, adLockPessimistic For i = 1 To MSFlexGrid1.Row - 1 rs_save.AddNew

rs_save.Fields(0) = Trim(Text1.Text)

rs_save.Fields(1) = CDate(Trim(comboy.Text) & \& Trim(combom.Text) & \& Trim(combod.Text))

rs_save.Fields(2) = Trim(Combo1.Text) MSFlexGrid1.Row = i MSFlexGrid1.Col = 0

rs_save.Fields(3) = Trim(MSFlexGrid1.Text) MSFlexGrid1.Col = 1

If crk1.Caption = \出库\

s = \ rs_save.Fields(4) = CDbl(s) Else

rs_save.Fields(4) = CDbl(Trim(MSFlexGrid1.Text)) End If

MSFlexGrid1.Col = 2

rs_save.Fields(5) = Trim(MSFlexGrid1.Text) MSFlexGrid1.Col = 3

rs_save.Fields(6) = Trim(MSFlexGrid1.Text) MSFlexGrid1.Col = 4

If crk1.Caption = \出库\

s = \ rs_save.Fields(7) = CDbl(s) Else

47

rs_save.Fields(7) = CDbl(Trim(MSFlexGrid1.Text)) End If

MSFlexGrid1.Col = 5

rs_save.Fields(8) = Trim(MSFlexGrid1.Text) Next i

rs_save.Update rs_save.Close

MsgBox \添加成功!\Unload Me Exit Sub saveerror:

MsgBox Err.Description End Sub

Private Sub Command2_Click() Unload Me End Sub

Private Sub Form_Load() Dim sql As String Dim i As Integer

On Error GoTo loaderror Combo1.AddItem (\北京\Combo1.AddItem (\上海\Combo1.AddItem (\天津\Combo1.AddItem (\武汉\Combo1.AddItem (\广州\Combo1.AddItem (\南京\Combo2.AddItem (\微利公司\Combo2.AddItem (\火星公司\Combo2.AddItem (\南山公司\Combo2.AddItem (\长虹公司\Combo2.AddItem (\利得公司\

For i = 2007 To 2020 comboy.AddItem i Next i

For i = 1 To 12 combom.AddItem i Next i

For i = 1 To 31 combod.AddItem i Next i setgrid

setgrid_head

'添加月份'添加月份 '添加日期 48

Text5.Visible = False clear_grid Exit Sub loaderror:

MsgBox Err.Description End Sub

Private Sub Form_Unload(Cancel As Integer) '关闭数据对象

'rs_checkname.Close 'rs_custom.Close End Sub

Public Sub setgrid() '设置表格子程序 Dim i As Integer

On Error GoTo seterror

MSFlexGrid1.ScrollBars = flexScrollBarBoth MSFlexGrid1.FixedCols = 0 MSFlexGrid1.Rows = row_num MSFlexGrid1.Cols = col_num

MSFlexGrid1.SelectionMode = flexSelectionByRow For i = 0 To row_num - 1

MSFlexGrid1.RowHeight(i) = 315 Next

For i = 0 To col_num - 1

MSFlexGrid1.ColWidth(i) = 1300 Next i Exit Sub seterror:

MsgBox Err.Description End Sub

Public Sub setgrid_head() On Error GoTo setheaderror MSFlexGrid1.Row = 0 MSFlexGrid1.Col = 0

MSFlexGrid1.Text = \物品名称\MSFlexGrid1.Col = 1

MSFlexGrid1.Text = \ 单价\MSFlexGrid1.Col = 2

MSFlexGrid1.Text = \数量\MSFlexGrid1.Col = 3

MSFlexGrid1.Text = \单位\MSFlexGrid1.Col = 4

MSFlexGrid1.Text = \ 金额\MSFlexGrid1.Col = 5

49

MSFlexGrid1.Text = \客户名\Exit Sub setheaderror:

MsgBox Err.Description End Sub

Public Sub clear_grid()

Dim i As Integer, j As Integer For i = 1 To row_num - 1 MSFlexGrid1.Row = i For j = 0 To col_num - 1 MSFlexGrid1.Col = j MSFlexGrid1.Text = \ Next j Next i End Sub

Public Sub nextposition(ByVal r As Integer, ByVal c As Integer) On Error GoTo nexterror

Text5.Width = MSFlexGrid1.CellWidth Text5.Height = MSFlexGrid1.CellHeight

Text5.Left = MSFlexGrid1.Left + MSFlexGrid1.ColPos(c) Text5.Top = MSFlexGrid1.Top + MSFlexGrid1.RowPos(r) Text5.Text = MSFlexGrid1.Text Text5.Visible = True Text5.SetFocus Exit Sub nexterror:

MsgBox Err.Description End Sub

Private Sub MSFlexGrid1_Click() If Combo2.Visible = True Then Exit Sub End If

nextposition MSFlexGrid1.Row, MSFlexGrid1.Col End Sub

Private Sub Text5_KeyPress(KeyAscii As Integer) Dim i As Integer, j As Integer

Dim price As Double, coun As Integer On Error GoTo texterror If KeyAscii = 13 Then

MSFlexGrid1.Text = Text5.Text

50

搜索更多关于: VB实例源码  的文档
VB实例源码 .doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c0rosj0d4ij47hq710ehk_10.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top