Jump to content

How to make a textbox not to show a specified number or letter ?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
11 replies to this topic

#1
kresh7

kresh7

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 661 posts
how can i make that a textbox dont show a number or a letter
when someone tries to tipp 6 there will nothing appear can someone show me that ?

#2
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
well in that case you will have to make that when vbKey6 (or something like that) is pressed text1.text = ""

or something similar. Sorry but I can't show you the code because VB6.0 is not installed.

#3
kresh7

kresh7

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 661 posts
thanks anyway :D i thing you mean using if text1.text = "6" then
text1.text = "" end if
i thing that should works but i thought there must be an easier way

#4
Skel

Skel

    Learning Programmer

  • Members
  • PipPipPip
  • 33 posts
If text1.text = "6" then
text1.text = "" 
End If 

That's the best way to do it..

#5
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
No i did not mean that, i mean you should monitor all buttons pressed and if 6 is pressed while you have a focus on text1 then text1.text=""

hope you understood better.

#6
kresh7

kresh7

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 661 posts

TcM said:

No i did not mean that, i mean you should monitor all buttons pressed and if 6 is pressed while you have a focus on text1 then text1.text=""

hope you understood better.

i never worked with focus before how is an example code ?

#7
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Well I don't have VB 6.0 installed but it's either something like text1.focus or use the procedure text1_onfocus() maybe something like that....

#8
kresh7

kresh7

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 661 posts
i will try it i hope i do it right

#9
badkarma

badkarma

    Newbie

  • Members
  • Pip
  • 7 posts

TcM said:

No i did not mean that, i mean you should monitor all buttons pressed and if 6 is pressed while you have a focus on text1 then text1.text=""

hope you understood better.

how about ... if the field is called text1...

private sub text1_KeyPress (KeyAscii as integer)

if (KeyAscii = 65) then text1 = ""

end sub 
When typing in text 1, if you type in "A", it blanks the field
so you could do something like ..

dim mypwd as string

private sub text1_KeyPress (KeyAscii as integer)

mypwd = mypwd  + chr(keyascii)
text1 = ""

end sub 


#10
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
I did not try it, but it seems like it would work.

Nice +rep given.

But please another time use code tags instead of color.

Thanks

#11
kresh7

kresh7

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 661 posts

badkarma said:

how about ... if the field is called text1...


private sub text1_KeyPress (KeyAscii as integer)


if (KeyAscii = 65) then text1 = ""


end sub 

When typing in text 1, if you type in "A", it blanks the field
so you could do something like ..


dim mypwd as string


private sub text1_KeyPress (KeyAscii as integer)


mypwd = mypwd  + chr(keyascii)

text1 = ""


end sub 

Thx a lot my frend for this

#12
kresh7

kresh7

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 661 posts
It dosent work i dont know why :S