📄 frmphjtin1.frm
字号:
Height = 225
Index = 15
Left = 750
TabIndex = 20
Top = 4710
Width = 855
End
Begin VB.Label Label1
Caption = "日 期"
Height = 225
Index = 8
Left = 750
TabIndex = 19
Top = 5100
Width = 855
End
End
Begin VB.Frame Frame2
Height = 675
Left = 60
TabIndex = 14
Top = 5430
Width = 4965
Begin VB.CommandButton Command1
Height = 315
Left = 600
Picture = "frmPHjtin1.frx":0000
Style = 1 'Graphical
TabIndex = 16
Top = 240
Width = 1065
End
Begin VB.CommandButton Command2
Height = 315
Left = 3060
Picture = "frmPHjtin1.frx":02E6
Style = 1 'Graphical
TabIndex = 15
Top = 240
Width = 1065
End
End
End
Attribute VB_Name = "frmPHjtin1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim env As rdoEnvironment
Dim cn As rdoConnection
Dim result As rdoResultset
Dim result1 As rdoResultset
Dim d_conn, sql As String
Dim hrowcount, hrowcount1 As Integer
Private Sub Combo1_Change()
Dim iStart As Integer
Dim sString As String
Static iLeftOff As Integer
iStart = 1
iStart = Combo1.SelStart
If iLeftOff <> 0 Then
Combo1.SelStart = iLeftOff
iStart = iLeftOff
End If
sString = CStr(Left(Combo1.Text, iStart))
Combo1.ListIndex = SendMessage(Combo1.hwnd, CB_FINDSTRING, -1, ByVal CStr(Left(Combo1.Text, iStart)))
If Combo1.ListIndex = -1 Then
iLeftOff = Len(sString)
Combo1.Text = sString
End If
Combo1.SelStart = iStart
iLeftOff = 0
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Combo1_LostFocus()
sql = "select * from clothtable where 布料编号='" & Trim(Combo1.Text) & "'"
Set result = cn.OpenResultset(sql, rdOpenDynamic, rdConcurRowVer)
If result.RowCount <> 0 Then
Text8.Text = result("幅宽")
Text9.Text = result("布料原长度")
End If
End Sub
Private Sub Combo2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Combo3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Command1_Click()
frmPHjtin.MSFlex1.TextArray((frmPHjtin.MSFlex1.Rows - 1) * frmPHjtin.MSFlex1.Cols) = Trim(Text6.Text)
frmPHjtin.MSFlex1.TextArray((frmPHjtin.MSFlex1.Rows - 1) * frmPHjtin.MSFlex1.Cols + 1) = Trim(Text2.Text)
frmPHjtin.MSFlex1.TextArray((frmPHjtin.MSFlex1.Rows - 1) * frmPHjtin.MSFlex1.Cols + 2) = Trim(Text3.Text)
frmPHjtin.MSFlex1.TextArray((frmPHjtin.MSFlex1.Rows - 1) * frmPHjtin.MSFlex1.Cols + 3) = Trim(Text4.Text)
frmPHjtin.MSFlex1.TextArray((frmPHjtin.MSFlex1.Rows - 1) * frmPHjtin.MSFlex1.Cols + 4) = Trim(Text5.Text)
frmPHjtin.MSFlex1.TextArray((frmPHjtin.MSFlex1.Rows - 1) * frmPHjtin.MSFlex1.Cols + 5) = Trim(Combo1.Text)
frmPHjtin.MSFlex1.TextArray((frmPHjtin.MSFlex1.Rows - 1) * frmPHjtin.MSFlex1.Cols + 6) = Trim(Text8.Text)
frmPHjtin.MSFlex1.TextArray((frmPHjtin.MSFlex1.Rows - 1) * frmPHjtin.MSFlex1.Cols + 7) = Trim(Text9.Text)
frmPHjtin.MSFlex1.TextArray((frmPHjtin.MSFlex1.Rows - 1) * frmPHjtin.MSFlex1.Cols + 8) = Trim(Text10.Text)
frmPHjtin.MSFlex1.TextArray((frmPHjtin.MSFlex1.Rows - 1) * frmPHjtin.MSFlex1.Cols + 9) = Trim(Text7.Text)
frmPHjtin.MSFlex1.TextArray((frmPHjtin.MSFlex1.Rows - 1) * frmPHjtin.MSFlex1.Cols + 10) = Trim(Text11.Text)
frmPHjtin.MSFlex1.TextArray((frmPHjtin.MSFlex1.Rows - 1) * frmPHjtin.MSFlex1.Cols + 11) = Trim(Combo2.Text)
frmPHjtin.MSFlex1.TextArray((frmPHjtin.MSFlex1.Rows - 1) * frmPHjtin.MSFlex1.Cols + 12) = Trim(Combo3.Text)
frmPHjtin.date1.Value = Trim(date1.Value)
frmPHjtin.MSFlex1.Rows = frmPHjtin.MSFlex1.Rows + 1
''''''''''
' Text2.Text = ""
' Text3.Text = ""
' Text4.Text = ""
' Text5.Text = ""
' Text6.Text = ""
' Text8.Text = ""
' Text9.Text = ""
' Text10.Text = ""
' Combo1.Text = ""
' Combo2.Text = ""
' Combo3.Text = ""
' Combo4.Text = ""
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub date1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Form_Load()
Set env = rdoEnvironments(0)
env.CursorDriver = rdUseOdbc
d_conn = "uid=sa;pwd=;driver={SQL SERVER};SERVER=ntserver;database=phdatabase;"
Set cn = env.OpenConnection(dsname:="odbc_api_demo", Prompt:="rdodriverprompt", ReadOnly:=False, Connect:=d_conn)
Move Screen.width / 2 - frmPHjtin1.width / 2, Screen.height / 2 - frmPHjtin1.height / 2
date1.Value = Format(Now, "long date")
sql = "select * from clothtable" ' order by 客户编号"
Set result = cn.OpenResultset(sql, rdOpenDynamic, rdConcurRowVer)
If result.RowCount <> 0 Then
Do While Not result.EOF()
Combo1.AddItem Trim(result("布料编号"))
result.MoveNext
Loop
End If
sql = "select * from worktable where 类别='设计员' order by 类别"
Set result = cn.OpenResultset(sql, rdOpenDynamic, rdConcurRowVer)
If result.RowCount <> 0 Then
Do While Not result.EOF()
Combo2.AddItem Trim(result("姓名"))
result.MoveNext
Loop
End If
'''''''''
sql = "select * from worktable where 类别='操作员' order by 类别"
Set result = cn.OpenResultset(sql, rdOpenDynamic, rdConcurRowVer)
If result.RowCount <> 0 Then
Do While Not result.EOF()
Combo3.AddItem Trim(result("姓名"))
result.MoveNext
Loop
End If
End Sub
Private Sub Text10_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text10_LostFocus()
If Text10.Text <> "" Then
Text7.Text = Format((Val(Text10.Text) * Val(Text8.Text)), "fixed")
End If
End Sub
Private Sub Text11_GotFocus()
Text11.Text = Format((Val(Text9.Text) - Val(Text10.Text)), "fixed")
End Sub
Private Sub Text11_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text4_GotFocus()
Dim point As Integer
Dim width
Dim height
Dim hstring As String
Dim hpoint As Integer
If Text3.Text <> "" Then
point = InStr(Text3.Text, "*")
width = Format(Mid(Trim(Text3.Text), 1, point - 1), "fixed")
hstring = Trim(Text3.Text)
hpoint = Len(Trim(Text3.Text)) - point
height = Format((Mid(hstring, point + 1, hpoint)), "fixed")
Text3.Text = width & "*" & height
''''''''
Text4.Text = Format((width * height), "fixed")
Else
MsgBox "画面规格不能为空!!"
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text7_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text8_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text8_LostFocus()
If Trim(Text8.Text) <> "" Then
Text8.Text = Format(Text8.Text, "fixed")
End If
End Sub
Private Sub Text9_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{tab}"
End If
End Sub
Private Sub Text9_LostFocus()
If Trim(Text9.Text) <> "" Then
Text9.Text = Format(Text9.Text, "fixed")
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -