Computer_IT/VisualBasic
[VB] Microsoft FlexGrid Control 6.0 Example
고급코드
2006. 9. 12. 10:39
반응형
- Option Explicit
- Private Sub cmdAdd_Click()
- Dim Rc As Integer ' RowCount
- Dim Kor As Integer, Eng As Integer, Math As Integer, Tot As Integer
- Dim ave As Single
- If Trim(txtName) = "" Then
- MsgBox "이름을 입력해줄래??"
- Exit Sub
- End If
- Rc = FGrid1.Rows
- FGrid1.Rows = Rc + 1
- ' 입력값 계산
- Kor = Val(txtKor)
- Eng = Val(txtEng)
- Math = Val(txtMath)
- Tot = Kor + Eng + Math
- ave = Round(Tot / 3, 2) ' 반올림 소수 2째 자리
- ' Flex Grid 에 값 넣기..
- FGrid1.TextMatrix(Rc, 0) = txtName
- FGrid1.TextMatrix(Rc, 1) = txtKor
- FGrid1.TextMatrix(Rc, 2) = txtEng
- FGrid1.TextMatrix(Rc, 3) = txtMath
- FGrid1.TextMatrix(Rc, 4) = Tot
- FGrid1.TextMatrix(Rc, 5) = ave
- ' 입력값 공백으로...
- txtName = ""
- txtKor = ""
- txtEng = ""
- txtMath = ""
- txtName.SetFocus
- End Sub
- Private Sub Form_Load()
- FGrid1.Rows = 1
- End Sub
반응형