Memory Drive

반응형
 
  1. Option Explicit
  2. Private Sub cmdAdd_Click()
  3. Dim Rc As Integer       ' RowCount
  4. Dim Kor As Integer, Eng As Integer, Math As Integer, Tot As Integer
  5. Dim ave As Single
  6.     If Trim(txtName) = "" Then
  7.         MsgBox "이름을 입력해줄래??"
  8.         Exit Sub
  9.     End If
  10.    
  11.     Rc = FGrid1.Rows
  12.     FGrid1.Rows = Rc + 1
  13.    
  14.     ' 입력값 계산
  15.     Kor = Val(txtKor)
  16.     Eng = Val(txtEng)
  17.     Math = Val(txtMath)
  18.    
  19.     Tot = Kor + Eng + Math
  20.    
  21.     ave = Round(Tot / 3, 2) ' 반올림 소수 2째 자리
  22.    
  23.    
  24.     ' Flex Grid 에 값 넣기..
  25.     FGrid1.TextMatrix(Rc, 0) = txtName
  26.     FGrid1.TextMatrix(Rc, 1) = txtKor
  27.     FGrid1.TextMatrix(Rc, 2) = txtEng
  28.     FGrid1.TextMatrix(Rc, 3) = txtMath
  29.     FGrid1.TextMatrix(Rc, 4) = Tot
  30.     FGrid1.TextMatrix(Rc, 5) = ave
  31.    
  32.     ' 입력값 공백으로...
  33.     txtName = ""
  34.     txtKor = ""
  35.     txtEng = ""
  36.     txtMath = ""
  37.    
  38.     txtName.SetFocus
  39.    
  40. End Sub
  41. Private Sub Form_Load()
  42.     FGrid1.Rows = 1
  43. End Sub
 
반응형