Re: Text_change the problem.
You could set a variable as a flag, and check for that.
Code:
Dim ValidChange as Boolean
ValidChange = vbFalse
I'll let you figure out the logic as where to place the check(s)
Re: Text_change the problem.
By using the codes below,i am blocking the entering space and letter in to the textbox
Code:
Private Sub txtmiktar_KeyPress(KeyAscii As Integer)
If KeyAscii <> 8 Then
If Not IsNumeric(Chr(KeyAscii)) Then KeyAscii = 0
End If
End Sub
Private Sub txttutar_KeyPress(KeyAscii As Integer)
If KeyAscii <> 8 Then
If Not IsNumeric(Chr(KeyAscii)) Then KeyAscii = 0
End If
End Sub
And i am get rid of unlimited turnovers. But when i delete the index of the textbox, it says error for the type mismatch.
Code:
Private Sub txtmiktar_Change()
txttutar.Text = CDbl(txtmiktar) * CDbl(txtbfiyat)
End Sub
Private Sub Txttutar_Change()
Dim x As Double
x = CDbl(txttutar) / CDbl(txtbfiyat)
txtmiktar.Text = x
End Sub
Thank you.
Re: Text_change the problem.
that's a totally different problem. why not try what I first suggested?
Re: Text_change the problem.
Think about it when does that code run and what does it do?
You change the text in one text box and the change event fires where you change the text in the other text box which fires the change event for it which then changes the text in the first one and round and round you go. It should be no surprise when your program falls into an endless loop.
You should be doing this int he keypress event or you need to have a flag that stops it from repeating the event.
This question was answered already in another thread on VB forumns and an example was given that showed how to avoid the endless loop using the change event.