CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2010
    Posts
    16

    Talking How to declare 1 digit only for visual basic 6.0?

    Hi, this is my source code

    Const pi = 3.14159265
    Dim Answer As Double

    Private Sub Command1_Click()
    converter = pi / 180
    Answer = Cos(Text1.Text * converter)
    Text2.Text = Answer
    End Sub


    I am having an answer of 1.79489651491878E-09

    but what can i add on my command to have only 0 as the answer?

  2. #2
    Join Date
    Apr 2009
    Posts
    394

    Re: How to declare 1 digit only for visual basic 6.0?

    Hmmm... Round, Format, FormatNumber, text1.text = 0, If Answer < 0 Then text1.text = 0...

    But it would help if we knew the value in text1.text...



    Good Luck

  3. #3
    Join Date
    Feb 2010
    Posts
    16

    Thumbs up Re: How to declare 1 digit only for visual basic 6.0?

    Quote Originally Posted by vb5prgrmr View Post
    Hmmm... Round, Format, FormatNumber, text1.text = 0, If Answer < 0 Then text1.text = 0...

    But it would help if we knew the value in text1.text...



    Good Luck
    hello sir i chose round, very great!! you're the best cheers

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