CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2000
    Posts
    57

    How to display a Real value in Engineering format

    How to display a Real value in Engineering format. For example I want to display .00001 as 1E-5.

    Secondly which is the best event to validate the input in a text box. I want the validation not to occur in case the user enters cancel. HOw can I acomplish this.

    Regards

    Ali.


  2. #2
    Join Date
    Apr 2001
    Posts
    23

    Re: How to display a Real value in Engineering format

    Put a textbox and a command button on a form and
    code as follows:
    [vbcode]

    Private Sub Command1_Click()
    Dim a As Double

    a = 0.00054 'can be any value or variable
    Text1 = Format(a, "0.E+0000")

    End Sub
    [/code]


  3. #3
    johnpc7 Guest

    Re: How to display a Real value in Engineering format

    Put a textbox and a command button on a form and
    code as follows:
    [vbcode]

    Private Sub Command1_Click()
    Dim a As Double

    a = 0.00054 'can be any value or variable
    Text1 = Format(a, "0.E+0000")

    End Sub
    [/code]


  4. #4
    Join Date
    Apr 2001
    Posts
    23

    Re: How to display a Real value in Engineering format

    Put a textbox and a command button on a form and
    code as follows:


    private Sub Command1_Click()
    Dim a as Double

    a = 0.00054 'can be any value or variable
    Text1 = Format(a, "0.E+0000")

    End Sub





  5. #5
    johnpc7 Guest

    Re: How to display a Real value in Engineering format

    Put a textbox and a command button on a form and
    code as follows:


    private Sub Command1_Click()
    Dim a as Double

    a = 0.00054 'can be any value or variable
    Text1 = Format(a, "0.E+0000")

    End Sub





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