0

I am new to Vb,

i am getting error in my source code,

here is my code snippet,

Dim a,b as integer 
  a=val (txtf.Text)
  b=val (txts.Text)
    if(a>b)then
       txtr=a
    else
      txtr=b
   end if 
end sub

ERROR: Runtime Error 424 Object Required:

any help will be appriciated.

3
  • 3
    Where does the error occur? Which line? Commented Nov 5, 2012 at 18:11
  • Are you using "option explicit on" ? Recommend you do. Commented Nov 5, 2012 at 21:05
  • Also it would be helpful to know the datatype of txtf, txts and txtr -- are they textbox controls? Commented Nov 5, 2012 at 23:01

4 Answers 4

5

It is safer to type

Dim a as Integer
Dim b as integer 

or

Dim a as integer,b as integer 

This might be the case of the error

Sign up to request clarification or add additional context in comments.

Comments

0

You haven't defined textr . Do that and your prob will be solved.

Comments

0

You did not specify txtr as txtr.txt instead it read txtr as an object...

Comments

0

Error that I found You should separate a,b; instead write is as:

Dim a as integer,b as integer or

Dim a as integer Dim b as integer

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.