Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 30
  1. #11

    bro sakto na si softtouch, i think sa VB6 naa nay KEYPRESS dira. so pwede ra evey KEYPRESS echeck nimu if ang key isNumeric. If so, continue, if it is not a numeric you can send a BEEP and do nothing else.

  2. #12
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    solve your problem using Microsoft Masked Edit Control, this provides an ability to control, restrict,and provide preformatted inputs to the system and fully helps your users as it gives some clues/guide on how to input such values.

    using regular expressions, builtin functions or event (keys) might do, but IMHO it does not provide effectiveness in your program, in a professional manner. And you have to catch some invalid inputs and might call more functions on the end. To think, that some inputs may led to system crash or bogus executions.

    There is a .NET version and a COM Object version.

    GoodLuck!

  3. #13
    Bitaw effective kau na na control. easy to use sd. dli lang kau ni ipagamit sa students usahay. hehehe

  4. #14
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    Quote Originally Posted by Artoy View Post
    Bitaw effective kau na na control. easy to use sd. dli lang kau ni ipagamit sa students usahay. hehehe
    teachers doesn't know? or never written on their student plan ? hehehe... We had a discussion on this bloody control, and we ended up debating "late/early bindings". Anyway, to cut the story, We use it only in some of our applications where the given inputs are directly process in our database (via stored procedure). The error was resolve along W/ .NET redistribution.

  5. #15
    wala paman ko ka ku-an ana .net

    mas sayon na sa vb6 or lisod?

  6. #16
    softouch is right..
    there are a lot of approaches in solving it and let me share you the simpliest and a better way in accepting only numbers in keypress event in vb6..

    txtID = control name

    Private Sub txtID_KeyPress(KeyAscii As Integer)
    If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = Then KeyAscii = 0
    End Sub


    note: every keys have it's ascii equivalent. like 0(number) = 48 (ascii)..so the code means if the input is not ascii from 48-57 or 0-9(in number itself) it returns 0 in ascii or no keyboard input...try to know the ascii equivalents of the keyborad inputs for you to know how to handle them..and by the way the cool smiley above is number '8' and it means a backspace key..heheh
    hope it helps..happy coding..

  7. #17
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    Quote Originally Posted by split_nutz View Post
    softouch is right..
    there are a lot of approaches in solving it and let me share you the simpliest and a better way in accepting only numbers in keypress event in vb6..

    txtID = control name

    Private Sub txtID_KeyPress(KeyAscii As Integer)
    If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = Then KeyAscii = 0
    End Sub


    note: every keys have it's ascii equivalent. like 0(number) = 48 (ascii)..so the code means if the input is not ascii from 48-57 or 0-9(in number itself) it returns 0 in ascii or no keyboard input...try to know the ascii equivalents of the keyborad inputs for you to know how to handle them..and by the way the cool smiley above is number '8' and it means a backspace key..heheh
    hope it helps..happy coding..


    dude... better better better better there are a lot of better codes because it is freely available on internet, where dumb coders will just have to copy/paste... code that exist 5 to 10 years ago.

    there's a lot of bug using this ascii you know? like what happened in KeyAscii from VB.
    BUG&#58; KeyAscii Behavior Different with DBCombo Control

    in the first place, why would someone code it like that? especially if you will consider future enhancement, on which you will going to include alphanumeric characters?

    I wonder why UTF-8 came out to replace ASCII, ISO 8859 and EUC at all types of levels, perhaps one of it was due to backward compatability... one of my friends tried to compile my source and later came back to me and said... "you handed me a puzzle of unmatched data type variable." without considering that we have to deal with unicode values from COM Object, and some IDE/GUI generate unicode strings, thus, code referring to If KeyAscii fails!!

  8. #18
    thanks guy

  9. #19
    @markcuering - i just said "better" coz it is not the best approach(we all know that)..f u wanted to share ur knwldge dnt make it complicated..a simple solution for a simple problm is d best way to learn..d TS just asked for a simple solution and i thnk d sample s good enough..he'll learn later what are the thngs that he must know..i got your point and you are right..the more knowldge u have d more problems u must handle..in reality, the more knwldge u gain for programming the more it becomes complicated..have a good day to all..

  10. #20
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    Agree, my post doesn't mean anything personal it is often use anyway (ASCII) like in game development, console, etc...

  11.    Advertisement

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

 
  1. would you be a linkin park or a dream theater??
    By fingolfin in forum Music & Radio
    Replies: 57
    Last Post: 05-25-2011, 05:42 PM
  2. Replies: 1
    Last Post: 03-02-2006, 12:58 PM
  3. publisher cannot be verified!
    By xinnuj in forum Software & Games (Old)
    Replies: 7
    Last Post: 01-03-2006, 11:38 AM
  4. MOVED: publisher cannot be verified!
    By vern in forum Networking & Internet
    Replies: 0
    Last Post: 12-30-2005, 08:12 AM
  5. Which should be settled first? Impeachment or Cha-cha
    By FK in forum Politics & Current Events
    Replies: 33
    Last Post: 08-10-2005, 07:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top