找回密碼
 註冊

VB RS232傳輸系統 (以解決,內有完整程式碼)

来源: 新聞 小柯柯 2011-11-4 16:39 只看這個作者 只看大圖 |閱讀模式
7 8097
本文最後由 編輯部女孩 於 2016-7-18 16:44 編輯

VB RS232傳輸系統 (以解決,內有完整程式碼)3908
按下"POWER"鍵
POWER燈會亮
會在班級姓名座號內顯示程式碼內的設定值
在國文英文數學空格內輸入成績
按下"傳送"鍵
平均的空格內會顯示三科平均
傳送燈會亮
然後傳送區的空格內會顯示>>>   國文多少分
                              英文多少分
                              數學多少分
                              平均分數多少分
按下"接收"鍵
接收燈會亮
將傳送區空格內的東西全部COPY過來接收區
然後最右邊的空格內會顯示
XX科不及格
XX科不及格
XX科不及格
不及格的科目平均分數
按下"清除"鍵
空格清除
按下"結束"鍵
視窗關閉
以上是這程式的目的
以下是我自己想的程式碼
Dim buf$
Private Sub Command1_Click()
Text1.Text = "小老婆幼幼班"
Text2.Text = "小柯柯"
Text3.Text = 9527
Shape1.FillColor = RGB(0, 255, 0)
End Sub
Private Sub Command2_Click()
Sum = Val(Text4.Text) + Val(Text5.Text) + Val(Text6.Text)
average = Sum / 3
average = Round(average, 2)
Text7.Text = average
    Text8.Text = "國文 Text4               英文 Text5               數學 Text6 "Text4Text5Text6就是要顯示國文英文數學的分數,怎麼在text裡面輸入text啊?
Shape2.FillColor = RGB(255, 0, 0)
End Sub
Private Sub Command3_Click()
Text9.Text = Text8
Shape3.FillColor = RGB(255, 0, 0)
    Text10.Text = ""
If Val(Text4.Text) < 60 Then
         Text10.Text = "國文不及格"
End If
If Val(Text5.Text) < 60 Then
         Text10.Text = "英文不及格"
End If
If Val(Text6.Text) < 60 Then
         Text10.Text = "數學不及格"
End If

這裡我完全不會寫   題目是說要如果國文50分跟英文30分不及格的話,最右邊的空格內要顯示:>> 國文不及格
                                                                                                                                                           英文不及格
                                                                                                                                                           平均分數40

End Sub
Private Sub Command4_Click()
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
End Sub
Private Sub Command5_Click()
End
End Sub
Private Sub Form_Load()
End Sub
以上紅色區域有疑問
可否教我一下
收藏
收藏0

網友回覆7

跳到指定樓層
本文最後由 編輯部女孩 於 2016-7-18 16:44 編輯

這科目真的是一科 我不知道怎麼修過的科目.....
KOSO 電壓表
JS  握把
某牌 快速油門
HSCY 防倒可調拉桿
KOSO 牌框
良輝 前盤組  離合器
JS    碗公
小羊 手工大回壓管
GE-RAING 前叉
DNM 無掛瓶17段阻尼可調後避震
本文最後由 編輯部女孩 於 2016-7-18 16:45 編輯

太久沒寫,語法忘光光了VB RS232傳輸系統 (以解決,內有完整程式碼)3153
專職被電腦修理,閒暇愛拍妹,CS 15年的自走肉靶
本文最後由 編輯部女孩 於 2016-7-18 16:45 編輯

我也太久沒寫忘光了VB RS232傳輸系統 (以解決,內有完整程式碼)2625
我之前學的是BCB 不過看起來介面跟程式碼都差不多

回覆 1# 小柯柯 的文章

本文最後由 編輯部女孩 於 2016-7-18 16:46 編輯

ANS1:
Text8.Text = "國文" & Text4.text  &  "英文" &  Text5.text & " 數學" & Text6.text
ANS2:
Text10.Text = "英文不及格">>Text10.Text =  Text10.Text + "英文不及格"
Text10.Text = "數學不及格" >>Text10.Text = Text10.Text + "數學不及格"
參與人數 1經驗值 +2 收起 理由
小柯柯 + 2 ANS1 是跑出來了 可是變得無法換航... ANS ...

瀏覽全部評分總評分 :  經驗值 +2

本文最後由 編輯部女孩 於 2016-7-18 16:46 編輯

If Val(Text6.Text) < 50 and Val(Text6.Text) < 30 Then
         Text10.Text = "國文不及格 英文不及格 平均分數 "  & ( Val(Text6.Text) + Val(Text6.Text) ) / 2   & "  "
End If
另外,培養個好習慣吧!
數學那個文字物件命名成這樣 txtMath
平均命名成這樣  txtAvg
剩下類推,這樣你以後會比較好寫。
程式是寫給自己看的,不是給電腦看的。。。。
參與人數 1經驗值 +5 收起 理由
小柯柯 + 5 謝謝你喔~你的可以用耶~ 可以再問你一個問 ...

瀏覽全部評分總評分 :  經驗值 +5

小時候不念書,長大是要還利息的
                       ~Address~~彎道舞者~~~
本文最後由 編輯部女孩 於 2016-7-18 16:46 編輯

Dim buf$
Private Sub Command1_Click()
Text1.Text = "小老婆"
Text2.Text = "小柯柯"
Text3.Text = 9527
Shape1.FillColor = RGB(0, 255, 0)
End Sub
Private Sub Command2_Click()
MSComm1.Output = Text8.Text
Sum = Val(Text4.Text) + Val(Text5.Text) + Val(Text6.Text)
average = Sum / 3
average = Round(average, 2)
Text7.Text = average
    Text8.Text = "國文 " & Text4.Text & "                       英文 " & Text5.Text & "                        數學 " & Text6.Text & " "
Shape2.FillColor = RGB(255, 0, 0)
End Sub
Private Sub Command3_Click()
buf = MSComm1.Input
If Len(buf) = 0 Then
        Text9.Text = "nothing"
Else
        Text9.Text = buf
End If
Shape3.FillColor = RGB(255, 0, 0)
    Text10.Text = ""
If Val(Text4.Text) < 60 Then
         Text10.Text = "國文不及格 平均分數 " & (Val(Text5.Text) + Val(Text6.Text)) / 2 & "  "
    End If
If Val(Text5.Text) < 60 Then
         Text10.Text = "英文不及格 平均分數 " & (Val(Text5.Text) + Val(Text6.Text)) / 2 & "  "
    End If
If Val(Text6.Text) < 60 Then
         Text10.Text = "數學不及格 平均分數 " & (Val(Text5.Text) + Val(Text6.Text)) / 2 & "  "
    End If
If Val(Text4.Text) < 60 And Val(Text5.Text) < 60 Then
         Text10.Text = "國文不及格 英文不及格 平均分數 " & (Val(Text5.Text) + Val(Text6.Text)) / 2 & "  "
    End If
If Val(Text4.Text) < 60 And Val(Text6.Text) < 60 Then
         Text10.Text = "國文不及格 數學不及格 平均分數 " & (Val(Text5.Text) + Val(Text6.Text)) / 2 & "  "
    End If
If Val(Text5.Text) < 60 And Val(Text6.Text) < 60 Then
         Text10.Text = "數學不及格 英文不及格 平均分數 " & (Val(Text5.Text) + Val(Text6.Text)) / 2 & "  "
    End If
If Val(Text4.Text) < 60 And Val(Text5.Text) < 60 And Val(Text6.Text) < 60 Then
         Text10.Text = "國文不及格 英文不及格 數學不及格 平均分數 " & (Val(Text5.Text) + Val(Text6.Text)) / 2 & "  "
    End If
End Sub
Private Sub Command4_Click()
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
End Sub
Private Sub Command5_Click()
MSComm1.PortOpen = False
End
End Sub
以上~
自己修改了一下~
可以使用了
感謝大家的幫忙
本文最後由 編輯部女孩 於 2016-7-18 16:46 編輯

ANS1:
Text8.Text = "國文" & Text4.text & vbCrLf   &  "英文" &  Text5.text & vbCrLf   & " 數學" & Text6.text
ANS2:
Text10.Text = "英文不及格">>Text10.Text =  Text10.Text + "英文不及格" & vbCrLf  
Text10.Text =  Text10.Text  & "數學不及格" >>Text10.Text = Text10.Text + "數學不及格"
小時候不念書,長大是要還利息的
                       ~Address~~彎道舞者~~~