Merhaba.
Classs ile textbox verilerini birleştirmeyi başaramadım.
Yukarıdaki kodda kontrol.name yerine kontrol.Text yazarsam odaklanmadan dolayı hata veriyor.Çözüm nedir?
Saygılar.
Form Kodlar;
Class kodlar;
Classs ile textbox verilerini birleştirmeyi başaramadım.
Visual Basic
- aa = aa & vbNewLine & kontrol.name
Yukarıdaki kodda kontrol.name yerine kontrol.Text yazarsam odaklanmadan dolayı hata veriyor.Çözüm nedir?
Saygılar.
Form Kodlar;
Visual Basic
- Option Compare Database
-
- Private KontrolCollection As Collection
-
-
- Private Sub Form_Load()
-
- Dim olay As ClassTextboxSec
- Dim kontrol As Access.Control
-
- Set KontrolCollection = New Collection
-
- For Each kontrol In Me.Controls
- If kontrol.ControlType = acTextBox Then
- Set olay = New ClassTextboxSec
- olay.Initialize kontrol
- KontrolCollection.Add olay, kontrol.name
- End If
- Next
-
- Set olay = Nothing
- Set Control = Nothing
-
- End Sub
-
-
- Private Sub Form_Unload(Cancel As Integer)
-
- Dim olay As ClassTextboxSec
-
- On Error Resume Next
-
- For Each olay In KontrolCollection
- olay.Terminate
- Next
-
- Set olay = Nothing
- Set KontrolCollection = Nothing
-
- End Sub
Class kodlar;
Visual Basic
- Option Compare Database
-
- Private Const olayTextBox As String = "[Event Procedure]"
-
- Private WithEvents ClassTextBox As Access.TextBox
-
- Public Sub Initialize(TextBox As Access.TextBox)
- Set ClassTextBox = TextBox
- ClassTextBox.OnChange = olayTextBox
- End Sub
-
-
- Public Sub Terminate()
- Set ClassTextBox = Nothing
- End Sub
-
-
- Private Sub ClassTextBox_Change()
-
- Dim kontrol As Control
- Dim aa
-
- For Each kontrol In Forms("Form1")
- aa = aa & vbNewLine & kontrol.name
- Next
-
- MsgBox aa
-
- End Sub