Thema Datum  Von Nutzer Rating
Antwort
29.09.2020 10:59:57 Pascal
NotSolved
Blau Komma in Punkt umwandeln mehrere Textboxen
29.09.2020 12:44:45 Gast1350
NotSolved
29.09.2020 14:52:51 Pascal
NotSolved
29.09.2020 16:47:26 Gast1350
NotSolved
29.09.2020 14:51:59 Gast6050
NotSolved

Ansicht des Beitrags:
Von:
Gast1350
Datum:
29.09.2020 12:44:45
Views:
712
Rating: Antwort:
  Ja
Thema:
Komma in Punkt umwandeln mehrere Textboxen

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'Klasse: MyTextBox
Option Explicit
 
Private m_objParent As MyControlWrapper
Private WithEvents m_objTextBox As MSForms.TextBox
 
Friend Function MapControl(Control As MSForms.Control, Wrapper As MyControlWrapper) As MyTextBox
  If Control Is Nothing Or Wrapper Is Nothing Then Exit Function
  Set m_objTextBox = Control
  Set m_objParent = Wrapper
  Set MapControl = Me
End Function
 
Private Sub m_objTextBox_Change()
  Call m_objParent.RaiseMyEvent("OnChange", m_objTextBox)
End Sub

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'Klasse: MyControlWrapper
Option Explicit
 
Event OnChange(ByVal Control As MSForms.Control)
 
Private m_colControls As VBA.Collection
 
Friend Sub RaiseMyEvent(EventName As String, Control As MSForms.Control)
  Select Case UCase$(EventName)
    Case "ONCHANGE": RaiseEvent OnChange(Control)
  End Select
End Sub
 
Public Function MapControls(UserForm As MSForms.UserForm) As Long
  Dim ctl As MSForms.Control
  Set m_colControls = New VBA.Collection
  For Each ctl In UserForm.Controls
    If TypeOf ctl Is MSForms.TextBox Then
      Dim obj As MyTextBox
      Set obj = New MyTextBox
      Call m_colControls.Add(obj.MapControl(ctl, Me))
    End If
  Next
  MapControls = m_colControls.Count
End Function
 
Public Sub Dispose()
  Set m_colControls = Nothing
End Sub

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'beliebige UserForm
Option Explicit
 
Private WithEvents m_objMyWrapper As MyControlWrapper
 
Private Sub m_objMyWrapper_OnChange(ByVal Control As MSForms.Control)
  Call MsgBox("Inhalt von '" & Control.Name & "' lautet jetzt: '" & Control.Text & "'", vbInformation)
End Sub
 
Private Sub UserForm_Initialize()
  Set m_objMyWrapper = New MyControlWrapper
  Call m_objMyWrapper.MapControls(Me)
End Sub
 
Private Sub UserForm_Terminate()
  Call m_objMyWrapper.Dispose
  Set m_objMyWrapper = Nothing
End Sub

Dein Code kommt in die markierte Stelle.


Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:



  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
29.09.2020 10:59:57 Pascal
NotSolved
Blau Komma in Punkt umwandeln mehrere Textboxen
29.09.2020 12:44:45 Gast1350
NotSolved
29.09.2020 14:52:51 Pascal
NotSolved
29.09.2020 16:47:26 Gast1350
NotSolved
29.09.2020 14:51:59 Gast6050
NotSolved