Results 1 to 32 of 32

Thread: [RESOLVED] Displaying Engineering Notation

  1. #1

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Resolved [RESOLVED] Displaying Engineering Notation

    I'm writing a program that will involve displaying electronics formulas. I would like to display the formulas in an accepted format familiar to students. Does anyone know of a font that would return the chr(codes) that I would need to produce Sq Roots, Pi, Sci/Eng Notation etc?

    Example:
    Code:
    Text1 = " 3 x " & "10" & Chr(179)       'Returns 3 x 10³
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  2. #2
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Displaying Engineering Notation

    Try to use font "Arial Unicode MS" with mathematical charcodes in range &H2200-&H22FF. Not sure what are engineering symbols.

    Use Character Map with the above font, select Unicode subrange Mathematical to view.

    Copy characters below, paste in Word then change font to "Arial Unicode MS", you can see more symbols.

    ∀ ∀ ∁ ∂ ∃ ∄ ∅ ∆ ∇ ∈ ∉ ∊ ∋ ∌ ∍ ∎
    ∏ ∐ ∑ − ∓ ∔ ∕ ∖ ∗ ∘ ∙ √ ∛ ∜ ∝ ∞
    ∟ ∠ ∡ ∢ ∣ ∤ ∥ ∦ ∧ ∨ ∩ ∪ ∫ ∬ ∭ ∮
    ∯ ∰ ∱ ∲ ∳ ∴ ∵ ∶ ∷ ∸ ∹ ∺ ∻ ∼ ∽ ∾
    ∿ ≀ ≁ ≂ ≃ ≄ ≅ ≆ ≇ ≈ ≉ ≊ ≋ ≌ ≍ ≎
    ≏ ≐ ≑ ≒ ≓ ≔ ≕ ≖ ≗ ≘ ≙ ≚ ≛ ≜ ≝ ≞
    ≟ ≠ ≡ ≢ ≣ ≤ ≥ ≦ ≧ ≨ ≩ ≪ ≫ ≬ ≭ ≮
    ≯ ≰ ≱ ≲ ≳ ≴ ≵ ≶ ≷ ≸ ≹ ≺ ≻ ≼ ≽ ≾
    ≿ ⊀ ⊁ ⊂ ⊃ ⊄ ⊅ ⊆ ⊇ ⊈ ⊉ ⊊ ⊋ ⊌ ⊍ ⊎
    ⊏ ⊐ ⊑ ⊒ ⊓ ⊔ ⊕ ⊖ ⊗ ⊘ ⊙ ⊚ ⊛ ⊜ ⊝ ⊞
    ⊟ ⊠ ⊡ ⊢ ⊣ ⊤ ⊥ ⊦ ⊧ ⊨ ⊩ ⊪ ⊫ ⊬ ⊭ ⊮
    ⊯ ⊰ ⊱ ⊲ ⊳ ⊴ ⊵ ⊶ ⊷ ⊸ ⊹ ⊺ ⊻ ⊼ ⊽ ⊾
    ⊿ ⋀ ⋁ ⋂ ⋃ ⋄ ⋅ ⋆ ⋇ ⋈ ⋉ ⋊ ⋋ ⋌ ⋍ ⋎
    ⋏ ⋐ ⋑ ⋒ ⋓ ⋔ ⋕ ⋖ ⋗ ⋘ ⋙ ⋚ ⋛ ⋜ ⋝ ⋞
    ⋟ ⋠ ⋡ ⋢ ⋣ ⋤ ⋥ ⋦ ⋧ ⋨ ⋩ ⋪ ⋫ ⋬ ⋭ ⋮
    ⋯ ⋰ ⋱ ⋲ ⋳ ⋴ ⋵ ⋶ ⋷ ⋸ ⋹ ⋺ ⋻ ⋼ ⋽ ⋾

    http://www.unicode.org/charts/PDF/U2200.pdf
    http://en.wikipedia.org/wiki/Unicode...ical_Operators
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  3. #3

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Displaying Engineering Notation

    Thanks Anhn, but that's a huge file (22MB) for just fonts and I'm not sure it's what I'm looking for. Most symbols can be found in the font selection provided in VB. What I want the most is exponents.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  4. #4
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Displaying Engineering Notation

    Probably this is the best suit for you without any add-on:
    With font "Palatino Linotype" (a standard font for any Windows system):
    You can have Chr$(185)="¹", Chr$(178)="²" and Chr$(179)="³",
    plus many more in range &H2010 - &H237A.

    Do the same as before, copy characters below, paste in Word then change font to "Palatino Linotype", you can see more symbols

    ‐ ‑ ‒ – — ― ‖ ‗ ‘ ’ ‚ ‛ “ ” „ ‟ † ‡ • ‣ ․ ‥ … ‧ 
 
 ‪ ‫ ‬ * *  
    ‰ ‱ ′ ″ ‴ ‵ ‶ ‷ ‸ ‹ › ※ ‼ ‽ ‾ ‿ ⁀ ⁁ ⁂ ⁃ ⁄ ⁅ ⁆ ⁇ ⁈ ⁉ ⁊ ⁋ ⁌ ⁍ ⁎ ⁏
    ⁐ ⁑ ⁒ ⁓ ⁔ ⁕ ⁖ ⁗ ⁘ ⁙ ⁚ ⁛ ⁜ ⁝ ⁞   ⁠ ⁡ ⁢ ⁣ ⁤ ⁥ ⁦ ⁧ ⁨ ⁩      
    ⁰ ⁱ ⁲ ⁳ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ⁺ ⁻ ⁼ ⁽ ⁾ ⁿ ₀ ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉ ₊ ₋ ₌ ₍ ₎ ₏
    ₐ ₑ ₒ ₓ ₔ ₕ ₖ ₗ ₘ ₙ ₚ ₛ ₜ ₝ ₞ ₟ ₠ ₡ ₢ ₣ ₤ ₥ ₦ ₧ ₨ ₩ ₪ ₫ € ₭ ₮ ₯
    ₰ ₱ ₲ ₳ ₴ ₵ ₶ ₷ ₸ ₹ ₺ ₻ ₼ ₽ ₾ ₿ ⃀ ⃁ ⃂ ⃃ ⃄ ⃅ ⃆ ⃇ ⃈ ⃉ ⃊ ⃋ ⃌ ⃍ ⃎ ⃏
    ⃐ ⃑ ⃒ ⃓ ⃔ ⃕ ⃖ ⃗ ⃘ ⃙ ⃚ ⃛ ⃜ ⃝ ⃞ ⃟ ⃠ ⃡ ⃢ ⃣ ⃤ ⃥ ⃦ ⃧ ⃨ ⃩ ⃪ ⃫ ⃬ ⃭ ⃮ ⃯
    ⃰ ⃱ ⃲ ⃳ ⃴ ⃵ ⃶ ⃷ ⃸ ⃹ ⃺ ⃻ ⃼ ⃽ ⃾ ⃿ ℀ ℁ ℂ ℃ ℄ ℅ ℆ ℇ ℈ ℉ ℊ ℋ ℌ ℍ ℎ ℏ
    ℐ ℑ ℒ ℓ ℔ ℕ № ℗ ℘ ℙ ℚ ℛ ℜ ℝ ℞ ℟ ℠ ℡ ™ ℣ ℤ ℥ Ω ℧ ℨ ℩ K Å ℬ ℭ ℮ ℯ
    ℰ ℱ Ⅎ ℳ ℴ ℵ ℶ ℷ ℸ ℹ ℺ ℻ ℼ ℽ ℾ ℿ ⅀ ⅁ ⅂ ⅃ ⅄ ⅅ ⅆ ⅇ ⅈ ⅉ ⅊ ⅋ ⅌ ⅍ ⅎ ⅏
    ⅐ ⅑ ⅒ ⅓ ⅔ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅛ ⅜ ⅝ ⅞ ⅟ Ⅰ Ⅱ Ⅲ Ⅳ Ⅴ Ⅵ Ⅶ Ⅷ Ⅸ Ⅹ Ⅺ Ⅻ Ⅼ Ⅽ Ⅾ Ⅿ
    ⅰ ⅱ ⅲ ⅳ ⅴ ⅵ ⅶ ⅷ ⅸ ⅹ ⅺ ⅻ ⅼ ⅽ ⅾ ⅿ ↀ ↁ ↂ Ↄ ↄ ↅ ↆ ↇ ↈ ↉ ↊ ↋ ↌ ↍ ↎ ↏
    ← ↑ → ↓ ↔ ↕ ↖ ↗ ↘ ↙ ↚ ↛ ↜ ↝ ↞ ↟ ↠ ↡ ↢ ↣ ↤ ↥ ↦ ↧ ↨ ↩ ↪ ↫ ↬ ↭ ↮ ↯
    ↰ ↱ ↲ ↳ ↴ ↵ ↶ ↷ ↸ ↹ ↺ ↻ ↼ ↽ ↾ ↿ ⇀ ⇁ ⇂ ⇃ ⇄ ⇅ ⇆ ⇇ ⇈ ⇉ ⇊ ⇋ ⇌ ⇍ ⇎ ⇏
    ⇐ ⇑ ⇒ ⇓ ⇔ ⇕ ⇖ ⇗ ⇘ ⇙ ⇚ ⇛ ⇜ ⇝ ⇞ ⇟ ⇠ ⇡ ⇢ ⇣ ⇤ ⇥ ⇦ ⇧ ⇨ ⇩ ⇪ ⇫ ⇬ ⇭ ⇮ ⇯
    ⇰ ⇱ ⇲ ⇳ ⇴ ⇵ ⇶ ⇷ ⇸ ⇹ ⇺ ⇻ ⇼ ⇽ ⇾ ⇿ ∀ ∁ ∂ ∃ ∄ ∅ ∆ ∇ ∈ ∉ ∊ ∋ ∌ ∍ ∎ ∏
    ∐ ∑ − ∓ ∔ ∕ ∖ ∗ ∘ ∙ √ ∛ ∜ ∝ ∞ ∟ ∠ ∡ ∢ ∣ ∤ ∥ ∦ ∧ ∨ ∩ ∪ ∫ ∬ ∭ ∮ ∯
    ∰ ∱ ∲ ∳ ∴ ∵ ∶ ∷ ∸ ∹ ∺ ∻ ∼ ∽ ∾ ∿ ≀ ≁ ≂ ≃ ≄ ≅ ≆ ≇ ≈ ≉ ≊ ≋ ≌ ≍ ≎ ≏
    ≐ ≑ ≒ ≓ ≔ ≕ ≖ ≗ ≘ ≙ ≚ ≛ ≜ ≝ ≞ ≟ ≠ ≡ ≢ ≣ ≤ ≥ ≦ ≧ ≨ ≩ ≪ ≫ ≬ ≭ ≮ ≯
    ≰ ≱ ≲ ≳ ≴ ≵ ≶ ≷ ≸ ≹ ≺ ≻ ≼ ≽ ≾ ≿ ⊀ ⊁ ⊂ ⊃ ⊄ ⊅ ⊆ ⊇ ⊈ ⊉ ⊊ ⊋ ⊌ ⊍ ⊎ ⊏
    ⊐ ⊑ ⊒ ⊓ ⊔ ⊕ ⊖ ⊗ ⊘ ⊙ ⊚ ⊛ ⊜ ⊝ ⊞ ⊟ ⊠ ⊡ ⊢ ⊣ ⊤ ⊥ ⊦ ⊧ ⊨ ⊩ ⊪ ⊫ ⊬ ⊭ ⊮ ⊯
    ⊰ ⊱ ⊲ ⊳ ⊴ ⊵ ⊶ ⊷ ⊸ ⊹ ⊺ ⊻ ⊼ ⊽ ⊾ ⊿ ⋀ ⋁ ⋂ ⋃ ⋄ ⋅ ⋆ ⋇ ⋈ ⋉ ⋊ ⋋ ⋌ ⋍ ⋎ ⋏
    ⋐ ⋑ ⋒ ⋓ ⋔ ⋕ ⋖ ⋗ ⋘ ⋙ ⋚ ⋛ ⋜ ⋝ ⋞ ⋟ ⋠ ⋡ ⋢ ⋣ ⋤ ⋥ ⋦ ⋧ ⋨ ⋩ ⋪ ⋫ ⋬ ⋭ ⋮ ⋯
    ⋰ ⋱ ⋲ ⋳ ⋴ ⋵ ⋶ ⋷ ⋸ ⋹ ⋺ ⋻ ⋼ ⋽ ⋾ ⋿ ⌀ ⌁ ⌂ ⌃ ⌄ ⌅ ⌆ ⌇ ⌈ ⌉ ⌊ ⌋ ⌌ ⌍ ⌎ ⌏
    ⌐ ⌑ ⌒ ⌓ ⌔ ⌕ ⌖ ⌗ ⌘ ⌙ ⌚ ⌛ ⌜ ⌝ ⌞ ⌟ ⌠ ⌡ ⌢ ⌣ ⌤ ⌥ ⌦ ⌧ ⌨ 〈 〉 ⌫ ⌬ ⌭ ⌮ ⌯
    ⌰ ⌱ ⌲ ⌳ ⌴ ⌵ ⌶ ⌷ ⌸ ⌹ ⌺ ⌻ ⌼ ⌽ ⌾ ⌿ ⍀ ⍁ ⍂ ⍃ ⍄ ⍅ ⍆ ⍇ ⍈ ⍉ ⍊ ⍋ ⍌ ⍍ ⍎ ⍏
    ⍐ ⍑ ⍒ ⍓ ⍔ ⍕ ⍖ ⍗ ⍘ ⍙ ⍚ ⍛ ⍜ ⍝ ⍞ ⍟ ⍠ ⍡ ⍢ ⍣ ⍤ ⍥ ⍦ ⍧ ⍨ ⍩ ⍪ ⍫ ⍬ ⍭ ⍮ ⍯
    ⍰ ⍱ ⍲ ⍳ ⍴ ⍵ ⍶ ⍷ ⍸ ⍹ ⍺
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  5. #5

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Displaying Engineering Notation

    Quote Originally Posted by anhn
    Probably this is the best suit for you without any add-on:
    With font "Palatino Linotype" (a standard font for any Windows system):
    You can have Chr$(185)="¹", Chr$(178)="²" and Chr$(179)="³",
    plus many more in range &H2010 - &H237A.
    Sorry for the long delay in responding but I wanted to be certain of what my response was going to be. Well Palatino Linotype will not produce the exponents that I need. I must be able to produce exponents from 10 to the minus 12th to 10 to the 12th power.

    When working in Word it's a totally different ball game, as Word (even my old 97 version) provides the nifty Superscript & Subscript functions. This feature lets the user manipulate letters and numbers in accepted IEEE format, nearly regardless of the FontName used. If I could import or code that kind of flexibility into VB I would be a very happy camper indeed!

    Thank you for your effort, but I'm still stuck in an exponent quagmire. I've spent endless hours Googling for a solution to no avail.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  6. #6
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    280

    Re: Displaying Engineering Notation

    Never tried it before so I might be talking rubbish but can't you insert a Word object?
    Slower than a crippled Vista
    More buggy than a fresh XP install
    Look! Down the road, some 50 miles behind the drunken snail.
    It's Ubuntu!

  7. #7

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Displaying Engineering Notation

    Quote Originally Posted by AsmIscool
    Never tried it before so I might be talking rubbish but can't you insert a Word object?
    No, you're not talking rubbish. A Word Doc most certainly can be embedded, but I don't want to do that. I find it very frustrating not to be able to print exponents to the Form, TextBoxes or Labels. That said, I may find that I have no choice. Grrrrr!
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  8. #8
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Displaying Engineering Notation

    Quote Originally Posted by CDRIVE
    I'm writing a program that will involve displaying electronics formulas. I would like to display the formulas in an accepted format familiar to students. Does anyone know of a font that would return the chr(codes) that I would need to produce Sq Roots, Pi, Sci/Eng Notation etc?

    Example:
    Code:
    Text1 = " 3 x " & "10" & Chr(179)       'Returns 3 x 10³
    That is totally different approaches. In Word, it uses formatting to produce subscript or supperscript.
    Here, it is plain text as you asked for the font that can give supperscript (exponent) and Sci notation.

    You may use RTB that allows you to format text or use a control that can support Unicode.
    Standard controls in VB6 does not support Unicode.

    Search Codebank you can find Unicode controls from Merri.
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  9. #9

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Displaying Engineering Notation

    Quote Originally Posted by anhn
    You may use RTB that allows you to format text or use a control that can support Unicode.
    Standard controls in VB6 does not support Unicode.

    Search Codebank you can find Unicode controls from Merri.
    Okay Anhn, I will check it out. BTW do you know when MS first included Ariel Unicode MS in Word, because my Office 97 doesn't include it.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  10. #10
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: Displaying Engineering Notation

    Consider using a webbrowser control to display a web page. Web page will contain formula formatted with HTML+CSS.

  11. #11
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Displaying Engineering Notation

    Forget about Arial Unicode MS, this is the largest font from MS (I am not sure but probably it was added in 2002).
    Make sure you have the Unicode version of Palatino Linotype.
    If you can use Arial Unicode MS then you can use Palatino Linotype (this is much smaller).

    I think Office 97 does not support Unicode (or does not fully support).
    Last edited by anhn; Jun 19th, 2008 at 08:35 PM.
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  12. #12

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Displaying Engineering Notation

    Quote Originally Posted by anhn
    Make sure you have the Unicode version of Palatino Linotype.
    If you can use Arial Unicode MS then you can use Palatino Linotype (this is much smaller).

    I think Office 97 does not support Unicode (or does not fully support).
    I have Palatino Linotype but I have no idea if it's the Unicode version?
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  13. #13

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Displaying Engineering Notation

    Quote Originally Posted by leinad31
    Consider using a webbrowser control to display a web page. Web page will contain formula formatted with HTML+CSS.
    Thanks leinad but if I go that rout I might as well just embed a word doc. I'm beginning to feel like a stubborn PITA!
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  14. #14
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Displaying Engineering Notation

    Quote Originally Posted by CDRIVE
    I have Palatino Linotype but I have no idea if it's the Unicode version?
    Palatino Linotype is one of Microsoft Windows standard fonts (comes with Time New Roman, Tahoma, Verdana, ...), I think it must be Unicode unless you use too old Windows version (98 or earlier).

    Use Character Map from Accessories you can view all available characters.
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  15. #15
    Lively Member
    Join Date
    Mar 2007
    Posts
    88

    Re: Displaying Engineering Notation

    If u just want to display, u can use a function that generate a label with the required exponent, and position it just next to the base

  16. #16

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Displaying Engineering Notation

    Quote Originally Posted by Amr Al-Amir
    If u just want to display, u can use a function that generate a label with the required exponent, and position it just next to the base
    This may seem obvious to you, but not to me. Would you like to post an example?
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  17. #17

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Displaying Engineering Notation

    Quote Originally Posted by anhn
    Palatino Linotype is one of Microsoft Windows standard fonts (comes with Time New Roman, Tahoma, Verdana, ...), I think it must be Unicode unless you use too old Windows version (98 or earlier).

    Use Character Map from Accessories you can view all available characters.
    Actually, I wrote a little utility to do that.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  18. #18
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Displaying Engineering Notation

    Why bother to do that unless it will be used in your project.
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  19. #19

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Displaying Engineering Notation

    Quote Originally Posted by anhn
    Why bother to do that unless it will be used in your project.
    Do what?
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  20. #20
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Displaying Engineering Notation

    Do this:
    Quote Originally Posted by CDRIVE
    Actually, I wrote a little utility to do that.
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  21. #21

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Displaying Engineering Notation

    Quote Originally Posted by anhn
    Do this:
    Oh that! I wrote that utility some time ago just because I could.
    BTW, I think this issue is resolved as I've discovered that a RTB will support Superscripts & Subscripts. I've not worked with RTB much so I need to get my feet good and wet! I'm sure I'll be asking some questions.
    Code:
    RichTextBox1.SelFontSize = 3
    RichTextBox1.SelCharOffset = 80
    I've also found that I can paste a numeric value (that's been Superscripted in Word) into a RTB and it retains its formatting. So I'm assuming that if I write the formatted text in Word and then input it as a file to a RTB, that will work also.... I think? Admittedly, I've never inputted a .doc before. Can it be done?
    Last edited by CDRIVE; Jun 20th, 2008 at 12:09 PM.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  22. #22

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Displaying Engineering Notation

    OK, I tried this and it doesn't retain the formatting. I also saved the Doc as a .RTF and the Input results were even worse.
    Code:
    Option Explicit
    Dim MyChar$
    
    Private Sub Command1_Click()
          RTB.Height = Me.Height
          RTB.Width = Me.Width
       ChDir ("C:\Documents and Settings\Owner\Desktop")
     '  Open "24x10.rtf" For Input As 1#
       Open "24x10.doc" For Input As 1#
          Do While Not EOF(1)                        ' Loop until end of file.
             MyChar$ = Input(1, #1)                   ' Get one character at a time.
             Text1.Text = Text1.Text & MyChar$
             RTB.Text = RTB.Text & MyChar$
          Loop
          Close #1                                   ' Close file.
    
    End Sub
    So I will either directly code Superscript & Subscript to the RTB or I will give in and embed a Word Doc in my app. In retrospect, I think embedding is the easiest solution.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  23. #23
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Displaying Engineering Notation

    RTB.Text is text only, you want RTB.RTFText (I think) which contains text and formatting.

  24. #24

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Displaying Engineering Notation

    Quote Originally Posted by si_the_geek
    RTB.Text is text only, you want RTB.RTFText (I think) which contains text and formatting.
    I thought I tried that but let my try it again.

    Thanks
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  25. #25
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Displaying Engineering Notation

    Quote Originally Posted by CDRIVE
    BTW, I think this issue is resolved as I've discovered that a RTB will support Superscripts & Subscripts. I've not worked with RTB much so I need to get my feet good and wet! I'm sure I'll be asking some questions.
    That is what I said in post#8. It takes you so long to discover.
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  26. #26
    Lively Member
    Join Date
    Mar 2007
    Posts
    88

    Re: Displaying Engineering Notation

    Quote Originally Posted by CDRIVE
    What I want the most is exponents.
    Here is a sample project which print exponents on a label
    Attached Files Attached Files

  27. #27

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Displaying Engineering Notation

    Quote Originally Posted by anhn
    That is what I said in post#8. It takes you so long to discover.
    Anhn you've hung in there throughout this rather long and laborious thread like a good soldier. I'm going to claim a senior moment! How I missed that comment in post 8, I don't know? My humble apologies!!

    Thank you for staying with me.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  28. #28

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Displaying Engineering Notation

    Quote Originally Posted by si_the_geek
    RTB.Text is text only, you want RTB.RTFText (I think) which contains text and formatting.
    Si, I gave it another try, just to make sure that I didn't miss something. My results were the same; no visible input to the RTB. Unless I read it wrong, the MSDN library info on the TextRTF property states that it's used to Output RTF to a RTF file.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  29. #29

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Displaying Engineering Notation

    Quote Originally Posted by Amr Al-Amir
    Here is a sample project which print exponents on a label
    Amr Al-Amr, thanks for the zip file. It's a novel approach. That said, it would be an exceedingly tedious task to write copious amounts of exponents in that fashion.

    I'm going to keep this file though, as it's very clever!!
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  30. #30
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Displaying Engineering Notation

    Quote Originally Posted by CDRIVE
    Si, I gave it another try, just to make sure that I didn't miss something. My results were the same; no visible input to the RTB. Unless I read it wrong, the MSDN library info on the TextRTF property states that it's used to Output RTF to a RTF file.
    Nope.. it is read and write. Here is what I see in MSDN (as usual, the first part gives the overview, and the Remarks section gives comments/examples/exceptions):
    Returns or sets the text of a RichTextBox control, including all .rtf code.

    Syntax
    ....

    Remarks

    Setting the TextRTF property replaces the entire contents of a RichTextBox control with the new string.

    You can use the TextRTF property along with the Print function to write .rtf files. The resulting file can be read by any other word processor capable of reading RTF-encoded text.
    While the last sentence gives one example of a way you can use it, that is certainly not the only thing you can do with it.

    I created a simple .RTF file with part of it in superscript, and it displayed perfectly with either of these methods:
    Code:
    Me.RichTextBox1.LoadFile "c:\folder\file.rtf"
    Code:
        'Load entire file into string
    Dim intFileNum As Integer, strFile As String
      intFileNum = FreeFile
      Open "c:\temp\superscript.rtf" For Binary As #intFileNum
      strFile = Space(LOF(intFileNum))
      Get #intFileNum, , strFile
      Close #intFileNum
      
        'put it into the control
      Me.RichTextBox1.TextRTF = strFile
    To write directly to the control in superscript, you can use code like this:
    Code:
    With Me.RichTextBox1
      .Font.Name = "Arial"
      .Font.Size = 8
      
      .Text = "103!"
      .SelStart = 2        'select just the "3"
      .SelLength = 1
      .SelFontSize = 6     'size of the superscript text
      .SelCharOffset = 5 * Screen.TwipsPerPixelX   'height above the baseline
    
      .SelStart = 0
      .SelLength = 0
    End With

  31. #31

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: [RESOLVED] Displaying Engineering Notation

    Si, I hesitated before marking this post resolved and now I know why. I have family in from out of town so I'll have to run your code later. Not that it will make any difference, but the file I was inputting was a doc that I saved as .RTF. Like I said, I doubt that that has anything to do with why it failed on me. Inputting as Binary is the key, I'm sure.

    Thanks for the code. I'll let you know how it works out.

    EDIT: Ran my mouth to soon! I ran the top example and it worked perfectly! Nothing to do with Binary! Thanks again Si!
    Last edited by CDRIVE; Jun 21st, 2008 at 11:30 AM.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  32. #32

    Thread Starter
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: [RESOLVED] Displaying Engineering Notation

    OK Si, I ran all your code and (no surprise) they all ran splendidly! I almost posted an 'Except for:' I kept getting an exclamation point in your With block. Do you know that the"!" typo is there?

    Thanks heaps Si!
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

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