Results 1 to 11 of 11

Thread: Finding max value of textbox

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2013
    Posts
    6

    Finding max value of textbox

    Hi guys,

    I need assistance with following code. There are 4 textboxes on the left side of the form and user is entering values in each of them. There is also fifth textbox on the right side of the form. After checking all values, fifth textbox (on the right side) need to move on the same height as height of textbox with maximum value entered. For example, if you enter following values:
    textbox1(3)
    textbox2(4)
    textbox3(1)
    textbox4(2)
    Fifth textbox needs to move on the same height as textbox2.
    I tried with following code:

    Dim First As Integer
    Dim Second As Integer
    Dim Third As Integer
    Dim Fourth As Integer
    Dim Max As Integer

    First = val(textbox1.text)
    Second = val(textbox2.text)
    Third = val(textbox3.text)
    Fourth = val(textbox4.text)

    If (First>Second) and (First>Third) and (First > Fourth) then
    Max = First
    textbox5.height = textbox1.height
    ElseIf (Second>First) and (Second>Third) and (Second>Fourth) then
    Max = Second
    textbox5.height = textbox2.height
    ElseIf (Third>First) and (Third>Second) and (Third>Fourth) then
    Max = Third
    textbox5.height = textbox3.height
    Else
    Max = Fourth
    Textbox5.height = textbox4.height

    I am absolute begginer wth VB, so please if somebody can help me with this code or some other idea is welcomed also.

    Thanks in advance
    Last edited by ser nicky; Apr 15th, 2013 at 01:18 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
  •  



Click Here to Expand Forum to Full Width