Page 2 of 2 FirstFirst 12
Results 41 to 59 of 59

Thread: need 2 decimal places

  1. #41

    Thread Starter
    Junior Member
    Join Date
    Jul 2018
    Posts
    21

    Re: need 2 decimal places

    Txttotcubic.Text shows 11.

  2. #42
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: need 2 decimal places

    I see you have taken NO advice from anyone here...you just keep struggling along with your antiquated, weird code.

    I'd like to help, but not until you put "Option Explicit" at the top of the form (or make that automatic as shown above), and you change your variable and textbox names to something that makes a bit more sense.

    This is NOT rocket science...just listen to, and take, the advice given above...ignore baka for a moment (sorry baka) and concentrate on what others have told you. Did you check the length of the textbox? (also, is it WIDE enough to even show more than "11.".

    But I digress...heed the advice first, then post your code (ALL applicable to this issue, not necessarily the entire project (I'm afraid to see what it would look like if it is anything like this short snippet you posted)).
    Sam I am (as well as Confused at times).

  3. #43
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: need 2 decimal places

    he has ignored me all the time, not responded at all, so u dont need to tell him that Sam. if he did follow my advice he would have figure it out already. what he needs is very simple stuff.

  4. #44

    Thread Starter
    Junior Member
    Join Date
    Jul 2018
    Posts
    21

    Re: need 2 decimal places

    To Sam and Baka
    I have tried all suggestions posted. I too had to figure out what the variables meant and am renaming them for clarity as suggested. I put Option Explicit on the top of the form. It did not give me errors. What Sam said made sense about the textbox named TxtTxttotcubic being sized wrong. So I increased the size, checked the variable dimensions, etc. to no avail.

    So I put a new textbox on the form, changed the calculation formula

    'Txttotcubic.Text =2.25 * (X + b + c + d) + (Txtsize(7).Text) + Txtf + txtG + Txth + Txti
    Sum = (Val(Txte) + Val(Txtf) + Val(Txth) + Val(Txti))
    Txt2.Text = Sum
    thanks Baka for the Val statements

    and the program works just fine!!!

    You are correct the code is very simple and would make the forum group laugh.

    I am changing all the variable names to be easily understood, this code was written in 2002 by a friend.

    My first programming was in 1970, Fortran, with punch cards on a computer that had its own campus. Second attempt in 1985 with a pc clone and Fortran again. Was not very good at programming then either.

    My program was written by my business partner in 1997. I suppled the calculation methods from National Electrical code and he programmed the software. The code changes every three years so I have been making minor changes as needed.

    Thanks to everyone that took the time to help resolve my problem.

  5. #45
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: need 2 decimal places

    Val() method is relatively ok if the input is not locale-dependent; otherwise, consider using CDbl() instead.

    However, Val() allows potential garbage to be considered as valid numeric data...
    Val("") = 0
    Val("2e3") = 2000 :: this isn't actually 'garbage', is a different way of expressing a value
    Val("2d3") = 2000 :: this isn't actually 'garbage', is a different way of expressing a value
    Val("1313 Mockingbird Lane") = 1313

    If input, i.e. textboxes, is used then you may want to provide some level of validation. People sometimes simply make typos when they enter text.
    Last edited by LaVolpe; Sep 24th, 2020 at 01:38 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  6. #46

    Thread Starter
    Junior Member
    Join Date
    Jul 2018
    Posts
    21

    Re: need 2 decimal places

    thanks will give it a try. The only text box entries on my form are numbers, if you try anything else a message box pops up and says wrong entry.
    I liked your explanation of what Val can cause.

    So my program is written VB6.0 which will soon lose support. I have visual studio 2017 and need to convert this program to vb.net

    Is there a translation app, book that I can use to compare code statements to upgrade? It is a big task with many lines of code however, I'm retired and have some time.

    Thanks again for your help

  7. #47

    Thread Starter
    Junior Member
    Join Date
    Jul 2018
    Posts
    21

    Re: need 2 decimal places

    Baka not ignoring you I'm new to forum and didn't know I could reply to you. It's hard to teach dinosaurs new tricks.
    here's what I sent to the general tread.

    I have tried all suggestions posted. I too had to figure out what the variables meant and am renaming them for clarity as suggested. I put Option Explicit on the top of the form. It did not give me errors. What Sam said made sense about the textbox named Txttotcubic being sized wrong. So I increased the size, checked the variable dimensions, etc. to no avail.

    So I put a new textbox on the form, changed the calculation formula

    'Txttotcubic.Text =2.25 * (X + b + c + d) + (Txtsize(7).Text) + Txtf + txtG + Txth + Txti
    Sum = (Val(Txte) + Val(Txtf) + Val(Txth) + Val(Txti))
    Txt2.Text = Sum
    thanks Baka for the Val statements

    and the program works just fine!!!

    You are correct the code is very simple and would make the forum group laugh.

    I am changing all the variable names to be easily understood, this code was written in 2002 by a friend.

    My first programming was in 1970, Fortran, with punch cards on a computer that had its own campus. Second attempt in 1985 with a pc clone and Fortran again. Was not very good at programming then either.

    My program was written by my business partner in 1997. I suppled the calculation methods from National Electrical code and he programmed the software. The code changes every three years so I have been making minor changes as needed.

    Thanks to everyone that took the time to help resolve my problem.

  8. #48
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: need 2 decimal places

    so, Txte IS a textbox? And -f, -h and -i). IF that is true, I SUGGEST you add the ".Text" after the name of the textbox....makes for better reading/understanding (especially by others). IF they are not textboxes, but NUMBERS, then I can see why you used Val()....but, as suggested, I would not...If I suspect a value to be a Double, I use CDbl, Integer, Cint, etc.

    Anyway, glad you succeeded in 'fixing' this.

    As far as migration to .Net world...no. There may be some attempts out there to convert small programs (.Net can do some), but larger ones would definitely be more work than starting from Scratch in .Net. And as far as support for VB6 and .Net....VB6 lost support many years ago, and .Net will very soon.

    If you are going to get into programming (again), I would suggest neither...plenty of good languages to learn.
    Sam I am (as well as Confused at times).

  9. #49
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: need 2 decimal places

    Quote Originally Posted by Electric Chuck View Post
    So my program is written VB6.0 which will soon lose support.
    VB6 actually lost support over a decade ago.

  10. #50
    Hyperactive Member
    Join Date
    Jul 2020
    Posts
    370

    Re: need 2 decimal places

    Quote Originally Posted by DataMiser View Post
    VB6 actually lost support over a decade ago.
    Some time ago, Microsoft promised to extend VB support if some signatures are collected. I wonder if now it is possible to persuade them to extend at least support? Without development.
    Problems with installing IDE on Win 10x 64 and, with VisualStudio 2008 and later installed, the service pack 6 does not work partly .

  11. #51
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: need 2 decimal places

    According to the info I saw on their site support ended in 2005 and extended support ended in 2008. The fact that it still works is about all one can hope for at this point and there is no way to know how long into the future it may continue to work. At this point is has far outlived its expected lifespan.

  12. #52
    Hyperactive Member
    Join Date
    Jul 2020
    Posts
    370

    Re: need 2 decimal places

    Quote Originally Posted by DataMiser View Post
    At this point is has far outlived its expected lifespan.
    There is no guarantee that VB will work on the next version of Windows. And that would be very insulting. A lot of code has been written.

  13. #53
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: need 2 decimal places

    as long windows 10 exists vb6 will also work, but we dont know about windows polaris/andromeda. but thats a future problem.

  14. #54
    Hyperactive Member
    Join Date
    Jul 2020
    Posts
    370

    Re: need 2 decimal places

    baka Everyone understands this. I am not sure that Microsoft will understand me as a foreigner. I think it would be correct if the Americans wrote a request for an extension of support. I am sure that people from other countries will support.
    VB's genius in creating shells with mouse clicks and setting properties for form and controls. It is extremely convenient and fast. It would be a shame to lose such a language.
    Since this year, VB.Net ceases to develop, which is just as regrettable.

  15. #55
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: need 2 decimal places

    to change a system that will make "compiled" vb6 to not work means to make almost all 32bit programs to not work anymore, not just vb6 exes.
    Im not concerned that vb6 will not work, only that they stop supporting 32bit. and when this happens, I hope there will be a way to run 32bit exe in a 64bit only system, using emulation or a program that convert 32 into 64.
    there will not be any 128bit system for a long time, so 32/64 and 64 only seems to be what we have for a decade or more.

  16. #56
    Hyperactive Member
    Join Date
    Jul 2020
    Posts
    370

    Re: need 2 decimal places

    The IDE may stop working.

  17. #57
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: need 2 decimal places

    IDE is not what Im worried about, its the compiled exe that worries me. will it work in all future windows 10 updates? will it work in the new OS that will be released.
    IDE you can always run in a VM or older OS, you can install windows 7/10 in a separate boot or use a "work" computer with that OS installed. I have 3 computers and nowadays you can buy a mini-desktop for 100$ that is sufficient for VB6 IDE.

  18. #58
    Hyperactive Member
    Join Date
    Jul 2020
    Posts
    370

    Re: need 2 decimal places

    I understand. But the best option would still be a collective appeal to Microsoft with a request to support the use of not only codes, but also IDEs.
    Perhaps these are just my illusions.

  19. #59
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: need 2 decimal places

    there has been appeals before but Microsoft is hard to deal with.
    the best deal would be to give the source code to the public, but its futile, Microsoft will never give that.

Page 2 of 2 FirstFirst 12

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