Vb.net problem

( a problem)

Page 1 of 1

6 Replies - 958 Views - Last Post: 17 May 2010 - 06:43 AM Rate Topic: -----

#1 bilalmukadam28  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 29-December 09

Vb.net problem

Posted 16 May 2010 - 07:07 AM

Hello,
I was trying to make a calculator which has number buttons ................

Everything was fine until a problem just popped out.
Here is the error:
Dim a As Integer = Convert.ToInt32(Label1.Text)
        Dim b As Integer = Convert.ToInt32(Label3.Text)


I know this sounds stupid but I just couldn't find a solution for it.
Hey buy the way I'm still a beginner.

Thanks for any help

Is This A Good Question/Topic? 0
  • +

Replies To: Vb.net problem

#2 Searock  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 35
  • View blog
  • Posts: 259
  • Joined: 15-September 09

Re: Vb.net problem

Posted 16 May 2010 - 07:16 AM

Can you post the exact error description?

Try inserting a breakpoint to make sure that the values stored in the label are not characters, since you can only convert numeric strings to integer or float ...
Was This Post Helpful? 0
  • +
  • -

#3 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon

Reputation: 2298
  • View blog
  • Posts: 9,535
  • Joined: 29-May 08

Re: Vb.net problem

Posted 16 May 2010 - 07:17 AM

What the error message? As that's just code.
Was This Post Helpful? 0
  • +
  • -

#4 bilalmukadam28  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 29-December 09

Re: Vb.net problem

Posted 16 May 2010 - 07:20 AM

View PostAdamSpeight2008, on 16 May 2010 - 06:17 AM, said:

What the error message? As that's just code.

Here is the error message.

"Input string was not in a correct format."
( Although I did put numbers!)
Was This Post Helpful? 0
  • +
  • -

#5 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon

Reputation: 2298
  • View blog
  • Posts: 9,535
  • Joined: 29-May 08

Re: Vb.net problem

Posted 16 May 2010 - 07:45 AM

What numbers did you input?
Was This Post Helpful? 0
  • +
  • -

#6 bilalmukadam28  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 29-December 09

Re: Vb.net problem

Posted 17 May 2010 - 06:39 AM

View PostAdamSpeight2008, on 16 May 2010 - 06:45 AM, said:

What numbers did you input?

I am just making a calculator. For example, I press 1, then plus, then 3 . When I press the equal button the error message shows.
Was This Post Helpful? 0
  • +
  • -

#7 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1729
  • View blog
  • Posts: 5,708
  • Joined: 25-September 09

Re: Vb.net problem

Posted 17 May 2010 - 06:43 AM

Show us more of the code so we can better determine what you are displaying in the labels prior to the execution of the code above.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1