结账之SSTab

前端之家收集整理的这篇文章主要介绍了结账之SSTab前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_403_0@ 刚打开结账窗体,就看到一个既陌生又亲切的控件---SSTab,记得在敲VB百例的时候,用过这个控件,今天看到它的时候一点都想不起来它叫什么来着,通过翻阅师姐的博客,才知道原来它就叫做SStab,是部件中的一个控件。

@H_403_0@

@H_403_0@加载工程→部件→控件 中勾选“Microsoft Tabbed Dialog Control”控件,点击应用

@H_403_0@介绍SSTab控件提供了一组选项卡,每个都充当一个容器,包含了其他的控件。控件中每次只有一个选项卡是活动的,给用户提供了其所包含的控件,而其他选项卡都是隐藏的。

@H_403_0@

@H_403_0@用法

@H_403_0@Private Sub SSTab1_Click(PrevIoUsTab As Integer)

@H_403_0@

Dim sum As Long,sum1 As Long,sum2 As Long
Dim i As Long
<span style="color:#009900;">'选择sstab的各个选项卡</span>
<strong>Select Case SSTab1.Tab
    Case 0   <span style="color:#009900;">'购卡</span></strong>
    <span style="color:#009900;">'从数据库中选择对应用户内容</span>
    txtsql1 = "select * from student_info where userid='" & Trim(combouserID.Text) & "'"
    Set mrc1 = Executesql(txtsql1,Msgtext)
    
        With myflexgrid1
            .Rows = 1
            .TextMatrix(0,0) = "学号"
            .TextMatrix(0,1) = "卡号"
            .TextMatrix(0,2) = "日期"
            .TextMatrix(0,3) = "时间"
            .TextMatrix(0,4) = "金额"
            Do While Not mrc1.EOF
                .Rows = .Rows + 1
                .CellAlignment = 4
                .TextMatrix(.Rows - 1,0) = mrc1.Fields(1)
                .TextMatrix(.Rows - 1,1) = mrc1.Fields(0)
                .TextMatrix(.Rows - 1,2) = mrc1.Fields(12)
                .TextMatrix(.Rows - 1,3) = mrc1.Fields(13)
                .TextMatrix(.Rows - 1,4) = mrc1.Fields(7)
                mrc1.MoveNext
                Call AdjustColWidth(frmcheckoutaccount,myflexgrid1)  <span style="color:#009900;">'自定调节myflexgrid的列宽</span>
           Loop
        End With
            
    <strong>Case 1      <span style="color:#009900;">'充值</span></strong>
    txtsql2 = "select * from recharge_info where userid='" & Trim(combouserID.Text) & "'"
    Set mrc2 = Executesql(txtsql2,Msgtext)
       
        With myflexgrid2
            .Rows = 1
            .TextMatrix(0,2) = "充值金额"
            .TextMatrix(0,3) = "日期"
            .TextMatrix(0,4) = "时间"
            Do While Not mrc2.EOF
                .Rows = .Rows + 1
                .CellAlignment = 4
                .TextMatrix(.Rows - 1,0) = mrc2.Fields(1)
                .TextMatrix(.Rows - 1,1) = mrc2.Fields(2)
                .TextMatrix(.Rows - 1,2) = mrc2.Fields(3)
                .TextMatrix(.Rows - 1,3) = mrc2.Fields(4)
                .TextMatrix(.Rows - 1,4) = mrc2.Fields(5)
                 mrc2.MoveNext
                Call AdjustColWidth(frmcheckoutaccount,myflexgrid2) <span style="color:#009900;"> '自定调节myflexgrid的列宽</span>
           Loop
            
       End With
   <strong> Case 2      <span style="color:#009900;"> '退卡</span></strong>
    txtsql3 = "select * from cancelcard_info where userid='" & Trim(combouserID.Text) & "'"
    Set mrc3 = Executesql(txtsql3,Msgtext)
    
        With myflexgrid3
            .Rows = 1
            .TextMatrix(0,4) = "退卡金额"
            Do While Not mrc3.EOF
                .Rows = .Rows + 1
                .CellAlignment = 4
                .TextMatrix(.Rows - 1,0) = mrc3.Fields(0)
                .TextMatrix(.Rows - 1,1) = mrc3.Fields(1)
                .TextMatrix(.Rows - 1,2) = mrc3.Fields(3)
                .TextMatrix(.Rows - 1,3) = mrc3.Fields(4)
                .TextMatrix(.Rows - 1,4) = mrc3.Fields(2)
                 mrc3.MoveNext
                Call AdjustColWidth(frmcheckoutaccount,myflexgrid3)  <span style="color:#009900;">'自定调节myflexgrid的列宽</span>
           Loop
        
        End With
   <strong> Case 3      <span style="color:#009900;">'临时用户</span></strong>
    txtsql4 = "select * from student_info where userid='" & Trim(combouserID.Text) & "' and type='临时用户'"
    Set mrc4 = Executesql(txtsql4,Msgtext)
    
        With myflexgrid4
            .Rows = 1
            .TextMatrix(0,4) = "金额"
            Do While Not mrc4.EOF
                .Rows = .Rows + 1
                .CellAlignment = 4
                .TextMatrix(.Rows - 1,0) = mrc4.Fields(1)
                .TextMatrix(.Rows - 1,1) = mrc4.Fields(0)
                .TextMatrix(.Rows - 1,2) = mrc4.Fields(12)
                .TextMatrix(.Rows - 1,3) = mrc4.Fields(13)
                .TextMatrix(.Rows - 1,4) = mrc4.Fields(7)
                mrc4.MoveNext
                Call AdjustColWidth(frmcheckoutaccount,myflexgrid4)  <span style="color:#009900;">'自定调节myflexgrid的列宽</span>
           Loop
           
        End With
    
 <strong>   Case 4  <span style="background-color: rgb(255,255);"><span style="color:#009900;"> '汇总</span></span></strong>
        txtsellcardcount.Text = myflexgrid1.Rows - 1    <span style="background-color: rgb(255,255);"><span style="color:#009900;"> '售卡数</span></span>
        txtcancelcardcount.Text = myflexgrid3.Rows - 1    <span style="color:#009900;"> '退卡数</span>
        txtallsellcard.Text = Val(txtsellcardcount.Text) - Val(txtcancelcardcount.Text)  <span style="color:#009900;"> '总售卡数</span>
        <span style="color:#009900;">'充值金额</span>
        For i = 1 To myflexgrid2.Rows - 1
        sum = sum + Val(myflexgrid2.TextMatrix(i,2))
        Next
        txtpay.Text = sum
       <span style="color:#009900;">  '退卡金额</span>
        For i = 1 To myflexgrid3.Rows - 1
        sum1 = sum1 + Val(myflexgrid3.TextMatrix(i,4))
        Next
        txtcancelcardpay.Text = sum1
        <span style="color:#009900;">'临时收取金额</span>
        For i = 1 To myflexgrid4.Rows - 1
        sum2 = sum2 + Val(myflexgrid4.TextMatrix(i,4))
        Next
        txtlspay.Text = sum2
        txtcountpay.Text = sum - sum1
    <strong>Case 5   </strong><span style="color:#009900;">'退出</span>
        Unload Me
<strong>End Select
End Sub</strong>

总结:当遇到一个陌生的事物时,就要慢慢去摸索、探究,在我们的不断努力下,它们就会甘拜下风,为我们所用,学习是这样,生活亦是这样,加油! 原文链接:https://www.f2er.com/vb/257327.html

猜你在找的VB相关文章