CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Join Date
    Mar 2009
    Posts
    118

    detecting value in input text box

    please i want
    Last edited by mahii; April 2nd, 2009 at 12:48 AM.

  2. #2
    Join Date
    Aug 2000
    Location
    Essex, Uk
    Posts
    1,214

    Re: detecting value in input text box

    This seems weird. I assume that the textbox has been populated with a value on form load or something. In that case, just set a form level variable to the value of the textbox, then on the lost focus event of the textbox simply do a check of the value to the form level variable if they are not the same set cancel = true and display your messagebox or whatever you want to do to tell the user that they need to be the same.

    If the user cannot change the value and you are scared that they will, why not disable the textbox which will stop the user overwriting the entry
    If you find my answers helpful, dont forget to rate me

  3. #3
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: detecting value in input text box

    New thread same question but not as much detail.

    If you would have answered my question you would have had your answer 2 days ago.

    It seems that what you really want is for someone to write your code for you. Since I do this for a living I would be willing to do that but I do not do it for free.

    If you want to learn to program then you have to learn to do this yourself and this will never happen if you get others to do it for you.

    So far you have been told exactly what code is needed to clear your forms. You have also been given suggestions to use a list or dropdown list for your selections. I even wrote a whole block of code and pointed out that what you were using would not work properly but when you resposted your attempt you were using the old code that was not compatiable with what you wanted to do.

    Go back to the other thread and look at the code, suggestions and question posted there. If you want help to finish it then answer the question Otherwise I will nto bother with any more posts on this topic.

  4. #4
    Join Date
    Mar 2009
    Posts
    118

    Re: detecting value in input text box

    Quote Originally Posted by DataMiser View Post
    New thread same question but not as much detail.

    If you would have answered my question you would have had your answer 2 days ago.

    It seems that what you really want is for someone to write your code for you. Since I do this for a living I would be willing to do that but I do not do it for free.

    If you want to learn to program then you have to learn to do this yourself and this will never happen if you get others to do it for you.

    So far you have been told exactly what code is needed to clear your forms. You have also been given suggestions to use a list or dropdown list for your selections. I even wrote a whole block of code and pointed out that what you were using would not work properly but when you resposted your attempt you were using the old code that was not compatiable with what you wanted to do.

    Go back to the other thread and look at the code, suggestions and question posted there. If you want help to finish it then answer the question Otherwise I will nto bother with any more posts on this topic.

    ............
    Last edited by mahii; April 2nd, 2009 at 12:51 AM.

  5. #5
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: detecting value in input text box

    I know exactly what you are asking and you have been given code already that will do exactly what you are asking. You have also been given ideas that would work better for you.

    I was tryign to help you learn at least a little for yourself but if you refuse to answer even a simple question to aide in this process then it would appear that i am wasting my time.

  6. #6
    Join Date
    Mar 2009
    Posts
    118

    Re: detecting value in input text box

    Quote Originally Posted by DataMiser View Post
    I know exactly what you are asking and you have been given code already that will do exactly what you are asking. You have also been given ideas that would work better for you.

    I was tryign to help you learn at least a little for yourself but if you refuse to answer even a simple question to aide in this process then it would appear that i am wasting my time.
    thanks brother ,
    Last edited by mahii; April 2nd, 2009 at 12:52 AM.

  7. #7
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: detecting value in input text box

    Look dude I simply asked you a question "Where do you think that code should go" I repeated it several times but you have still not answered it. I wanted to know your answer so I could help you understand what you were doing.

    The fact is that it is about the simpliest question you will ever encounter and the answer was right there in front of you the whole time. Is it to much to ask that you apply a little tought and/or effort into solving your problem.

    If dataentered is correct then
    everything is fine
    else
    not so fine we need to do something different here
    end if

    Or select case Value
    case correct
    everything is fine
    case else
    everythign is not fine we need to do something
    end select

    You have been given every line of code to do exactly what you want to do. All you needed to do was place the final 3 lines in the right place, You claimed you tryed it everywhere but of course that is not true because you would have found the right place if you had, It is very very simple to figure out if only you are willing to try. If not then maybe programming is not the area you should be focusing on.

  8. #8
    Join Date
    Mar 2009
    Posts
    118

    Re: detecting value in input text box

    now you please provide me the code
    Last edited by mahii; April 2nd, 2009 at 12:52 AM.

  9. #9
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: detecting value in input text box

    Use the Keypress Event of the textbox, trap the BACKSPACE KEY, and when it's fired, clear the other forms.



    Code:
    Private Sub cmdA_Click()
      MsgBox "Button A clicked!"
    End Sub
    
    Private Sub cmdB_Click()
      MsgBox "Button B clicked!"
    End Sub
    
    Private Sub cmdC_Click()
      MsgBox "Button C clicked!"
    End Sub
    
    Private Sub cmdD_Click()
      MsgBox "Button D clicked!"
    End Sub
    
    Private Sub Form_KeyPress(KeyAscii As Integer)
    
      '  The ASCII values 97 to 122(lowercase) and 65 to 90(Upercase)
        Select Case KeyAscii
            Case 97 'a
                cmdA_Click
            Case 98 'b
                cmdB_Click
            Case 99 'c
                cmdC_Click
            Case 100 'd
                cmdD_Click
            Case Else
               
        End Select
        
    End Sub
    Otherwise, when v clicks command button, pop up another form with 3 lines of info. When they exit that form (modal), clear the first form.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  10. #10
    Join Date
    Mar 2009
    Posts
    118

    Re: detecting value in input text box

    Quote Originally Posted by dglienna View Post
    Use the Keypress Event of the textbox, trap the BACKSPACE KEY, and when it's fired, clear the other forms.

    thanks friend for ur reply and for thanks always to be part of my threads...
    Last edited by mahii; April 2nd, 2009 at 12:53 AM.

  11. #11
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: detecting value in input text box

    Tell ya what...

    If you put this in a form:
    Code:
    Private Sub Form_KeyPress(KeyAscii As Integer)
    
        MsgBox KeyAscii
    
    End Sub

    You'll be able to figure out the KayAscii of each character...

    btw... (You didn't listen to my LISTBOX advice)
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  12. #12
    Join Date
    Mar 2009
    Posts
    118

    Re: detecting value in input text box

    Quote Originally Posted by dglienna View Post
    Tell ya what...

    If you put this in a form:
    Code:
    Private Sub Form_KeyPress(KeyAscii As Integer)
    
        MsgBox KeyAscii
    
    End Sub

    You'll be able to figure out the KayAscii of each character...

    btw... (You didn't listen to my LISTBOX advice)

    ist of all thank you for ur good responce
    Last edited by mahii; April 2nd, 2009 at 03:10 AM.

  13. #13
    Join Date
    Mar 2009
    Posts
    118

    Re: detecting value in input text box

    Quote Originally Posted by dglienna View Post
    Tell ya what...

    If you put this in a form:
    Code:
    Private Sub Form_KeyPress(KeyAscii As Integer)
    
        MsgBox KeyAscii
    
    End Sub

    You'll be able to figure out the KayAscii of each character...

    btw... (You didn't listen to my LISTBOX advice)


    brother i have almost done it
    Last edited by mahii; April 2nd, 2009 at 03:07 AM.

  14. #14
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: detecting value in input text box

    You do not need to write code to make the backspace work as a backspace in a text box. That is the normal funtion of the system assuming the cursor is in the correct position.

  15. #15
    Join Date
    Mar 2009
    Posts
    118

    Re: detecting value in input text box

    ok brother i solved my one problem
    Last edited by mahii; April 2nd, 2009 at 03:07 AM.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured