![]() | |
| | #1 (permalink) |
| Üye Üyelik Tarihi: 03/2004 Yer: Geniş ve Loş Bir Yer.
Mesaj: 1,138
| Kod:
Public Function ceevir(ByVal islem As String) As String
Dim result As String
Dim strip As String
Dim lead As String
Dim length1 As Integer
Dim length2 As Integer
Dim position As String
Dim length As Integer
length1 = 0
If islem = "" Then islem = "0"
strip = islem.Replace("(", "")
strip = strip.Replace(")", "")
strip = strip.Replace("-", "")
strip = strip.Replace(" ", "")
Debug.WriteLine(strip, "Strip value")
length = strip.Length
Debug.WriteLine(length, "Length of strip")
Do
position = strip.Substring(length1, 1)
Debug.WriteLine(position, "Position")
length2 = length1
length1 = length1 + 1
If position Like "[0-9]" = False Then length1 = length
Loop Until (length1 = length)
Debug.WriteLine(length2, "Length2")
Debug.WriteLine(position, "Position")
If position Like "[0-9]" = True Then
If length = 10 Then
result = "(" & strip.Substring(0, 3) & ") " & strip.Substring(3, 3) & " " & strip.Substring(6, 2) & " " & strip.Substring(8, 2)
ElseIf length = 11 Then
result = "(" & strip.Substring(1, 3) & ") " & strip.Substring(4, 3) & " " & strip.Substring(7, 2) & " " & strip.Substring(9, 2)
Else
result = islem
End If
End If
Return result
End Function
Private Sub TextBox10_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox10.TextChanged
Dim result As String
If Me.TextBox10.Text.Length = 10 Then
result = ceevir(TextBox10.Text)
TextBox10.Text = result
TextBox10.SelectionStart = 17
End If
End Sub
Private Sub TextBox11_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox11.TextChanged
Dim result As String
If Me.TextBox11.Text.Length = 10 Then
result = ceevir(TextBox11.Text)
TextBox11.Text = result
TextBox11.SelectionStart = 17
End If
End Sub
Private Sub TextBox10_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox10.KeyDown
If e.KeyCode = Keys.Back Then
Dim m As String
If Me.TextBox10.Text.Length = 15 Then
Me.TextBox10.Text = Replace(Me.TextBox10.Text, ")", "")
Me.TextBox10.Text = Replace(Me.TextBox10.Text, " ", "")
End If
If Me.TextBox10.Text.Length = 11 Then
m = Microsoft.VisualBasic.Mid(Me.TextBox10.Text, 3, 12)
Me.TextBox10.Text = m
End If
End If
End Sub
If e.KeyCode = Keys.Back Then Dim m As String If Me.TextBox10.Text.Length = 15 Then Me.TextBox10.Text = Replace(Me.TextBox10.Text, ")", "") Me.TextBox10.Text = Replace(Me.TextBox10.Text, " ", "") End If koduyla boşlukları ve ) işaretini sildim ama bunların içine bunu ( da koyunca, diğerlerinide yapmaktan vaz geçiyor. bende yukarıdaki gibi denedim ama nafile şimdi ben textbox10 da backspace tusuna basınca numara 2162222222 şekline gelmesini istiyorum enson (2162222222 da kaldım parantezi silemedim sağdan aldım soldan aldım yine yok olmuyor bi türlü.
__________________ Öfkeli iken konuşun, göreceksiniz ki pişman olacağınız en güzel konuşmayı yapmışsınızdır.. Reklam Oku Para Kazan |
| | |
| | #2 (permalink) |
| İptal Durumu Üyelik Tarihi: 04/2004 Yer: M86
Mesaj: 1,092
| 1.Yöntem "Enter"'e basıtğında metini düzeltir. Kod: Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
Dim x As String
x = ""
If KeyCode = 13 Then
For i = 1 To Len(Text1.Text)
If ((Asc(Mid(Text1.Text, i, 1)) <= Asc("9")) And (Asc(Mid(Text1.Text, i, 1)) >= Asc("0"))) Then
x = x & Mid(Text1.Text, i, 1)
End If
Next i
Text1 = x
End If
End Sub
TextBox'a sadece rakam girilebilir. Kod: Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal nNew As Long) As Long Const GWL_STYLE = (-16) Const ES_NUMBER = &H2000 Private Sub Form_Load() SetWindowLong Text1.hWnd, GWL_STYLE, GetWindowLong(Text1.hWnd, GWL_STYLE) Or ES_NUMBER End Sub |
| | |
| | #3 (permalink) |
| Bilgisayarcı Üyelik Tarihi: 10/2002 Yer: İstanbul
Mesaj: 3,060
|
Ben böyle denedim çalıştı : If Me.TextBox10.Text.Length = 15 Then Me.TextBox10.Text = Replace(Me.TextBox10.Text, ")", "") Me.TextBox10.Text = Replace(Me.TextBox10.Text, " ", "") Me.TextBox10.Text = Replace(Me.TextBox10.Text, "(", "") End If |
| | |
| | #6 (permalink) |
| Bilgisayarcı Üyelik Tarihi: 10/2002 Yer: İstanbul
Mesaj: 3,060
|
Birinci verdiğin örnek VB.NET 'e şöyle çevriliyor (denenmiştir) : Kod: Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
Dim x As String
Dim i As Integer
x = ""
If e.KeyCode = Keys.Enter Then
For i = 1 To Len(TextBox1.Text)
If ((Asc(Mid(TextBox1.Text, i, 1)) <= Asc("9")) And (Asc(Mid(TextBox1.Text, i, 1)) >= Asc("0"))) Then
x = x & Mid(TextBox1.Text, i, 1)
End If
Next i
TextBox1.Text = x
End If
End Sub
|
| | |
| | #7 (permalink) | |
| Üye Üyelik Tarihi: 03/2004 Yer: Geniş ve Loş Bir Yer.
Mesaj: 1,138
| Alıntı:
keyDown olmadan önceki hali = (222) 222 22 22 olduktan sonraki hali = (222) 222 22 2 eğer o parantezlerden 1 tanesi ni kaldırırsam yani Code Kod: If Me.TextBox10.Text.Length = 15 Then
Me.TextBox10.Text = Replace(Me.TextBox10.Text, " ", "")
Me.TextBox10.Text = Replace(Me.TextBox10.Text, "(", "")
End If
__________________ Öfkeli iken konuşun, göreceksiniz ki pişman olacağınız en güzel konuşmayı yapmışsınızdır.. Reklam Oku Para Kazan | |
| | |
| | #9 (permalink) |
| Üye Üyelik Tarihi: 03/2004 Yer: Geniş ve Loş Bir Yer.
Mesaj: 1,138
|
bilmem ki akşam bi deniyim ama hiç sanmıyorum öyle olsa o kodu dememe amaçlı olarak button içine yazıyim bakalım yapacak mi...mantıken çok saçma bişii.. ha bu arada 1 üstteki mesajımda 2. code da yaptım daha sonra başka bir olay içine Kod: Me.TextBox10.Text = Replace(Me.TextBox10.Text, "(", "")
sağınan 10 tanesini al dedim durum = (2223334455 idi bu olmasılazımdı=2223334455 ama yine olmadı mid olarak denedim yanıt yok yine bakalım ne yapazac.
__________________ Öfkeli iken konuşun, göreceksiniz ki pişman olacağınız en güzel konuşmayı yapmışsınızdır.. Reklam Oku Para Kazan |
| | |
| | #10 (permalink) | |
| Bilgisayarcı Üyelik Tarihi: 10/2002 Yer: İstanbul
Mesaj: 3,060
| Alıntı:
| |
| | |
![]() |
| Bookmarks |
| Seçenekler | |
| |
Benzer Konular | ||||
| Konu | Konuyu açana göre | Forum | Cevap | En Son Mesaj |
| Karakter!!! | gok_tengri | Protesto | 0 | 06/12/2006 17:37 |
| Karakter Sorunu | SiberDevlet | PHP | 7 | 31/10/2005 02:54 |
| forumda boş karakter | smasherz | Javascript / DHTML / Ajax | 13 | 07/03/2005 12:05 |
| bol karakter | theskull | ASP | 2 | 01/01/2005 12:52 |
| Karakter sorunu | Pyramid | PHP | 4 | 27/09/2004 16:16 |
| Reklamlar & Desteklenenler | |
| Hassas Valf | Hassas Kaplama | Antalyamız | Gazete | Ticari Bilişim | Hakan Müştak | Rüya Tabirleri | Kadın | Hastalıklar | Cepte msn ve e-posta | Webmaster | Antalya Aupair | Turkish Property Antalya | Forum | Chat | Perde | Adsl | Araba | bolindir.com | guncelle.com | livescore | Web Tasarım | evden eve nakliyat | forum | evden eve | sohbet | Resimcim| Kalifiye İnsan Kaynakları | Web Tasarım | Oyun | Yusuf KOÇ | Akın Yorulmaz | şiir | UFO | Web Tasarım | Oyunlar | Canlı Tv | |