- Katılım
- 2 Mart 2005
- Mesajlar
- 2,960
- Excel Vers. ve Dili
- ev: Ofis 2007- Win Xp
iş: Ofis 2010- Win Vista
Kod:
'Private Sub txtSonAkt_Exit(ByVal Cancel As MSForms.ReturnBoolean)
' With txtSonAkt
' If .Text <> "" Then .Text = Format(.Text, "#,##0.0000")
' End With
'End Sub
Yukarıdaki işlemleri yapacağım textbox sayısı fazla olduğu için aşağıdaki class modulü yazdım, ve userformun açılışında ser ettim.
Ancak Set işelmeini yapıyor, yalnız set edilen textboxtan çıkınca formatlamayı yapmıyor. Hatam nerede?
Class Modulüm:
Kod:
Option Explicit
Public WithEvents txtOkuma As MSForms.TextBox
Sub txtokuma_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Stop
With txtOkuma
If .Text <> "" Then .Text = Format(.Text, "#,##0.0000")
End With
End Sub
Userformun ilgili kodları
Kod:
Option Explicit
Dim txtOkuma() As New Cls_SycTkp
Private CKtp_Bu As Workbook
Private CSfData As Worksheet
Private adbBagl As ADODB.Connection
Private adbKset As ADODB.Recordset
Const msjBas As String = "HSR Sayaç Takip"
Sub Cls_SycTkpAc()
Dim ufKont As Object, i As Byte
For Each ufKont In Me.fraSon.Controls
If TypeOf ufKont Is MSForms.TextBox Then
i = i + 1
ReDim Preserve txtOkuma(i)
Set txtOkuma(i).txtOkuma = Me.fraSon.Controls(ufKont.Name)
End If
Next
Stop
End Sub
Private Sub UserForm_Initialize()
Call Cls_SycTkpAc
' Call adbBagl_Aç
' Call adbKset_İsimler_Aç
End Sub
